Skip to content
Loading
how to popup gridview from text box search in asp.net
 Code For .cs
  1. using System;  
  2. using System.Data;  
  3.   
  4. namespace WebApp1  
  5. {  
  6.     public partial class WebForm1 : System.Web.UI.Page  
  7.     {  
  8.         protected void Page_Load(object sender, EventArgs e)  
  9.         {  
  10.             if (!IsPostBack)  
  11.             {  
  12.                 loadStores();  
  13.             }  
  14.         }  
  15.   
  16.         protected void loadStores()  
  17.         {  
  18.             // for making  Table     
  19.             DataTable dt = new DataTable();  
  20.   
  21.             // these are the table columns    
  22.             dt.Columns.Add("id"typeof(int));  
  23.             dt.Columns.Add("name"typeof(string));  
  24.             dt.Columns.Add("education"typeof(string));  
  25.             dt.Columns.Add("location"typeof(string));  
  26.   
  27.             // these are the table rows with values    
  28.             dt.Rows.Add(1, "Nilesh""B.E(IT)""Rajkot");  
  29.             dt.Rows.Add(2, "Purnima""B.E(CSE)""Rajkot");  
  30.             dt.Rows.Add(3, "Chandni""MSc(IT)""Ahmedabad");  
  31.             dt.Rows.Add(4, "Rinku""MBA""Pune");  
  32.             dt.Rows.Add(5, "Nilu""MBBS""Bikaner");  
  33.   
  34.             gridView1.DataSource = dt;  
  35.             gridView1.DataBind();  
  36.   
  37.         }  
  38.   
  39.         protected void gridView1_SelectedIndexChanged(object sender, EventArgs e)  
  40.         {  
  41.             txtname.Value = gridView1.SelectedRow.Cells[2].Text;  
  42.             ModalPopupExtender1.Hide();  
  43.         }  
  44.     }  

  • Hi Amit mohanty
    Thanks for reply
     
    Great. it's working fine to me but small changes
     
     
     
     
    Once again Thank you so much 
  • Amit Mohanty
    Hey check the below links, this may help you.
     
    https://www.aspsnippets.com/Articles/Display-GridView-Row-details-in-New-Popup-Window-on-HyperLink-click-using-JavaScript-and-jQuery-in-ASPNet.aspx
     
    http://asp.net-informations.com/gridview/popup.htm
     
    https://www.c-sharpcorner.com/UploadFile/009464/how-to-show-data-of-gridview-on-pop-up-with-the-help-of-rowd/