I want to display a gridview in alert message like alert('
Loading
I want to display a gridview in alert message like alert('
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vijay Pratap SinghRank #381 · 6.6K reputationPosted Apr 19, 2024, 1:51 AM EDT
Displaying a
GridViewinside an alert message in ASP.NET is not directly supported because an alert message typically contains text and does not support complex HTML structures like aGridView. you can achieve a similar result by using a modal dialogue or a custom popup.Here's a basic example of how you can achieve this using a modal dialogue:
GridView.Open Modal × Data Grid // Function to open the modal dialog function openModal() { // Show the modal dialog document.getElementById("myModal").style.display = "block"; // Load data into the GridView loadData(); } // Function to close the modal dialog function closeModal() { // Hide the modal dialog document.getElementById("myModal").style.display = "none"; } // Function to load data into the GridView function loadData() { // Perform AJAX request to fetch data // Populate the gridContainer div with the GridView HTML // Example: document.getElementById("gridContainer").innerHTML = ""; }Hope this will help.
Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2024, 12:44 PM EDT
That alert function is a JavaScript alert, correct? The JavaScript alert function only supports text.