Asp.Net how to open new popup windows page When double click on Gridview row
Introduction : This tutorial explain how to open new windows popup page when selecting or double click on gridview rows and pass some row values to other web page using gridview rows in asp.net for this we can use the gridview Rowdatabound.
Step: 1 From GridView1_RowDataBound you can type following code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Data.DataRowView drv = e.Row.DataItem as System.Data.DataRowView;
e.Row.Attributes.Add("ondblclick", String.Format("window.open('Test1.aspx?uname={0}','Test1','left =200, top=280, height = 400, width= 400, status =no, resizable=yes,directories=no,addressbar=no, titlebar=0, scrollbars =yes, toolbar =0, location =0, menubar = no')", drv["uname"]));
}
}
Step: 2 Now, when you Run programe and double click on gridview row the new popup windows can be open as following. here Test1.aspx is new windows popup page it can be display row value like user name using QueryString
Step: 1 From GridView1_RowDataBound you can type following code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Data.DataRowView drv = e.Row.DataItem as System.Data.DataRowView;
e.Row.Attributes.Add("ondblclick", String.Format("window.open('Test1.aspx?uname={0}','Test1','left =200, top=280, height = 400, width= 400, status =no, resizable=yes,directories=no,addressbar=no, titlebar=0, scrollbars =yes, toolbar =0, location =0, menubar = no')", drv["uname"]));
}
}
Step: 2 Now, when you Run programe and double click on gridview row the new popup windows can be open as following. here Test1.aspx is new windows popup page it can be display row value like user name using QueryString
Sign up here with your email
ConversionConversion EmoticonEmoticon