Asp.Net Open Page as Modal Dialog — Parent Child Window Example

How to open Child Window From Parent Page and Close that Child window on Grid Editing and Use that Value  in Parent Page.

Put this Javascript on button’s  onClientSxript event


function ViewAllHelp()

{    window.showModalDialog(‘frmViewEmployeeMaster.aspx’,’name’,’dialogHeight:417px; dialogWidth:800px; scroll:yes; status:no;location:no;’);

And in form ViewAll put this line in Html Tag

<base target=”_self”></base>

Now you can fill  Gridview for records and in Gridview Edit Operation you can close that modal Dialog  Form from the following Code

protected void dg_RowEditing(object sender, GridViewEditEventArgs e)
Label lblid = new Label();
lblid.Text = ((Label)dg.Rows[e.NewEditIndex].FindControl(“id”)).Text.ToString();
ClientScript.RegisterClientScriptBlock(typeof(string), “closing”, “<script>window.close();</script>”);

And by using that session you can Use that value in Parent Page.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s