How to call new popup window from double-click on GridView’s row asp.net c#

However, sometimes we need to show a pop-up window from a GridView by the click of a button. The new window can display corresponding data, extracted from either a different database table or the same table

Step 1 : Create asp.net web project , in GridView RowDataBound we need to add below code for open new window popup

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

How to call new popup window from double-click on GridView's row asp.net c#

SEE MORE

Leave a Reply

Your email address will not be published. Required fields are marked *