asp.net 2 and popups

J

janetb

I've trying to implement a popup from an asp.net 2.0 page, but I don't know the complete url (parameters) to pass until about the second or third page event (I have placeholders that toggle between visible/non-visible that call different sql stuff making up the parameters.) I'm trying to use some code from an article I got at dotnetjohn, and need some help. If I hardcode the page and parameters in the Public strURL string instantiation below, it works, but I don't know what that url should be until two more button clicks in the page. How do I "reset" the strURL later in the page events so that the corrent page and parameters are sent? (I tried moving the call to within the sub where the parameters are gathered and no dice.) Thanks in advance.

On the aspx page, I have a button that only appears through two steps of button clicks with different id names:
<asp:ImageButton runat="server" ID="btnPrint" ImageUrl="icon_pr.gif" AlternateText="print it" />

In code behind page, I have:

Public strURL As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
OpenPopUp(btnPrint, strURL)
''''''''blah, blah, blah
End If
End Sub

Public Shared Sub OpenPopUp(ByVal opener As System.Web.UI.WebControls.WebControl, ByVal PagePath As String)
Dim clientScript As String
'Building the client script- window.open
clientScript = "window.open('" & PagePath & "','printWindow','400,400');return false;"
'register the script to the clientside click event of the opener control
opener.Attributes.Add("onclick", clientScript)
End Sub

'''in the second button click, on the page, I have this:
Protected Sub chkSelectedItems(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelectList.Click
Dim coList As String = ""
Dim tblList As String = ""
Dim varGetProfile As Int32 = 0
'''''blah, blah get some sql2005 stuff, then
btnPrint.Visible = "true"
strURL = "display_pr.aspx?chp=" & varGetProfile & "&id=" & _
Mid(Replace(tblList, ",", "~"), 2, Len(tblList) - 1) & "&co=" & _
Mid(Replace(coList, ",", "~"), 2, Len(coList) - 1)
end sub


__
Newsgroups brought to you courtesy of www.dotnetjohn.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top