how to passing parameter on windows.open method?

tommyboy

Active member
Joined
Jun 21, 2005
Messages
34
Programming Experience
Beginner
Dear friends or anyone out there,
I have this problem in windows.open(" & path & ") function to
pop up new web page when user click a button in main form!
Okay I'll try explain how i facing problem in conjuction with above method!

Well i have 2 web forms created (index.aspx and rptfrm.aspx), one is main form whilst other is sub site to be pop up and display a record
from a table called Student, with ibmDB2 as backend.I also have one vb class module,(global.vb) that holds certain variables which acts like global variable for my coding!

I have created publically one string typed variable called ibmCom,
Public ibmCom As String = "SELECT * FROM MEMBER ORDER BY MEMID"

in my index.aspx (main page), i have one dropdown list box which have certain options which let the user to choose how to sort the record that
can be yielded from the Student table.Like example. For e.g., say my drop down list has few options like sorted by id, sorted by total marks ,sorted by name, etc.

And i have one function inside my index.aspx web form(code behind method), which will assign the new ibm Command string to ibmCom public variable,
which have chosen accordingly by the user from dropdown list box.

If the user select sorted by name and click Enter button to pop up the record in new page (rptfrm.aspx),
I'll get the first click button result correctly, but when user click another selection from the same dropdown list box, then it display the same sorted record from previous drop down selected option instead current one!
But if the user click second time then they can get their desired sorted record.

In short, my problem is,the user has to click second time for getting the record display accordingly to their selection from the drop down list!
I suspect the ibmCom variable doesn't seemed to be passed probly from the index.aspx form to rptfrm.aspx form!

Below are some functions which related to my problem :-

Legend :-
ddl1 ==> drop down list
ibmCom ==> public string type variable which declared in global.vb

Function setIbmCom()
If (ddl1.SelectedItem.Text Is "Sorted by member Name ") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY MEMNAME"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by member ID") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY MEMID"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by Total Point") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY TOTALPOINT DESC"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by Bar Status") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY BARSTATUS"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by Best Points") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY BESTPOINTS DESC"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by Recent Points") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY RECENTPOINTS DESC"
ElseIf (ddl1.SelectedItem.Text Is "Sorted by Last Played Time") Then
ibmCom = "SELECT * FROM MEMBER ORDER BY LASTPLAYEDTIME DESC"
End If
End Function

Public Sub Opennewwindow(ByVal Opener As System.Web.UI.WebControls.WebControl, ByVal PagePath As String)
Call setIbmCom()
Dim Clientscript As String

Clientscript = "window.open('" & PagePath & "')"

Opener.Attributes.Add("Onclick", Clientscript)

End Sub

'PAGE LOAD FOR index.aspx FORM
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call setIbmCom()
Opennewwindow(Button1, "rptfrm.aspx")
End Sub

'PAGE LOAD FOR rptfrm.aspx FORM
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
'CrystalReportViewer1.DataBind = reporstsource
Dim myConnection As New DB2Connection
'SqlClient.SqlConnection()
myConnection.ConnectionString = "Database=NUMBERS;UID=db2admin;PWD=dcs;"
Dim MyCommand As New DB2Command
MyCommand.Connection = myConnection
MyCommand.CommandText = ibmCom '"SELECT * FROM MEMBER ORDER BY MEMNAME"
MyCommand.CommandType = CommandType.Text
Dim MyDA As New DB2DataAdapter
MyDA.SelectCommand = MyCommand
Dim myDS As New Dataset1
'This is our DataSet created at Design Time
MyDA.Fill(myDS, "MEMBER")
'You have to use the same name as that of your Dataset that you created during design time
Dim oRpt As New CrystalReport1
' This is the Crystal Report file created at Design Time
oRpt.SetDataSource(myDS)
' Set the SetDataSource property of the Report to the Dataset
'Dim crv As New CrystalReportViewer2
CrystalReportViewer1.ReportSource = oRpt
' Set the Crystal Report Viewer's property to the oRpt Report object that we created
Catch ex As Exception

End Try

End Sub
 
Back
Top