Passing data to popup window






1.50/5 (3 votes)
Jun 28, 2006

19393

118
Passing data to popup window without postback
Introduction
The article/code useful to pass data from webpage's codebehind to popup window.it is more interactive and it should happen without postback also.
Using the code
In a source webpage Fromwhich we are going to pass a data to popuForm.aspx,The following example code are used in datagrid_itemcommand event to pass binded data in datagrid while clicking a linkbutton control which also be contained in datagrid.
Dim strScript As String = "popupForm.aspx?Id=" & e.Item.Cells(0).Text
strScript = "WindowOpen('" & strScript & "',800,300);"
Page.RegisterStartupScript("Email", "<script> & strScript & </script><script>" & strScript & "</script>")
Now,In the Page_load event of popupForm.aspx we can get the Id value what we passed from source webpage.
Dim getId as integer = Request.QueryString("Id")