wym
asked on
ASP.NET and popup windows with dynamic URLs
Hi there:
Newbie here and I must not be understanding something fundamental.
I can pop up a window if I RegisterClientScriptBlock in the Page_Load method.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim popupScript As String = "<script language='JavaScript'> function DoClick(){ window.open('test.aspx','P opUp','loc ation=no,t oolbar=no, status=no, menubar=no ,scrollbar s=yes,resi zable=yes' ) }<" & "/script>"
Page.RegisterStartupScript ("PopupScr ipt", popupScript)
'snip
End Sub
This works fine but I want to give a name-value pair like test.aspx?name=value. Value will be found by firing a MenuItemClicked event, which will then read the contents of a cell of an active row of a grid.
Private Sub UltraWebMenu1_MenuItemClic ked(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWe bNavigator .WebMenuIt emEventArg s) Handles UltraWebMenu1.MenuItemClic ked
Dim row As Infragistics.WebUI.UltraWe bGrid.Ultr aGridRow
Dim iProfileKey As Integer
Select Case e.Item.Text
case "Profile"
row = UltraWebGrid1.DisplayLayou t.ActiveRo w
iProfileKey = CInt(row.Cells(0).Text)
Dim popupScript As String = "<script language='JavaScript'> function DoClick(){ window.open('test.aspx?=iP rofileKey" & iProfileKey & "','PopUp','location=no,to olbar=no,s tatus=no,m enubar=no, scrollbars =yes,resiz able=yes') }<" & "/script>"
Page.RegisterStartupScript ("PopupScr ipt", popupScript)
end Select
End Sub
However, this doesn't work. How can you popup a window given a dynamic URL? Must RegisterClientScriptBlock be in Page_Load?
Newbie here and I must not be understanding something fundamental.
I can pop up a window if I RegisterClientScriptBlock in the Page_Load method.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim popupScript As String = "<script language='JavaScript'> function DoClick(){ window.open('test.aspx','P
Page.RegisterStartupScript
'snip
End Sub
This works fine but I want to give a name-value pair like test.aspx?name=value. Value will be found by firing a MenuItemClicked event, which will then read the contents of a cell of an active row of a grid.
Private Sub UltraWebMenu1_MenuItemClic
Dim row As Infragistics.WebUI.UltraWe
Dim iProfileKey As Integer
Select Case e.Item.Text
case "Profile"
row = UltraWebGrid1.DisplayLayou
iProfileKey = CInt(row.Cells(0).Text)
Dim popupScript As String = "<script language='JavaScript'> function DoClick(){ window.open('test.aspx?=iP
Page.RegisterStartupScript
end Select
End Sub
However, this doesn't work. How can you popup a window given a dynamic URL? Must RegisterClientScriptBlock be in Page_Load?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you CuSo4. Once I understood the problem, I could fix it!
//Generate some code that will create the url and store it in dynURL
btnMenu.Attributes.Add("on