S
simon
hello.
hopefully another quick newbie question for you....
I have a codebehind function coded to handle the click event of a
button. what this function does is insert values from a data grid
into the database. after that is done i want to send the user to
PageC, but before i do that i check a variable value. if that value
is "0" then i want to raise a javascript alert telling the user they
need to set some info in PageA and then automatically send them to
PageA
in the bottom of the function, i have the following....
If PrefCount = 0 Then
Dim strMessage As String = "Your data has not been set yet, you
will be sent to that page to fill it out"
Dim strScript As String = "<script language=JavaScript>alert('" &
strMessage & "');</script>"
If (Not Page.IsClientScriptBlockRegistered("prefCheckScript"))
Then
Page.RegisterClientScriptBlock("prefCheckScript", strScript)
End If
NextButton.Attributes.Add("onClick", "return prefCheckScript();")
Response.Redirect("PageA.aspx")
End If
as i step thru the code i see that everything is firing and working
correctly except that the javascipt pop-up doesn't come up and they
are sent directly to PageA, which is kind of what i want except i want
the popup alert to show and when they click OK, they are then
redirected to PageA.
i also tried using IsStartupScriptRegistered/RegisterStartupScript
first, same thing happens.
adding the onClick attribute to the button doesn't make much sense
here as they have already clicked the button to get into this
function. i put that in just because i saw it on web page out there.
basically trying to figure out how to kick off this javascript
conditionally. don't want it to popup/redirect if my IF condition is
false. but its not firing at all at this point.
thanks for any help!!
hopefully another quick newbie question for you....
I have a codebehind function coded to handle the click event of a
button. what this function does is insert values from a data grid
into the database. after that is done i want to send the user to
PageC, but before i do that i check a variable value. if that value
is "0" then i want to raise a javascript alert telling the user they
need to set some info in PageA and then automatically send them to
PageA
in the bottom of the function, i have the following....
If PrefCount = 0 Then
Dim strMessage As String = "Your data has not been set yet, you
will be sent to that page to fill it out"
Dim strScript As String = "<script language=JavaScript>alert('" &
strMessage & "');</script>"
If (Not Page.IsClientScriptBlockRegistered("prefCheckScript"))
Then
Page.RegisterClientScriptBlock("prefCheckScript", strScript)
End If
NextButton.Attributes.Add("onClick", "return prefCheckScript();")
Response.Redirect("PageA.aspx")
End If
as i step thru the code i see that everything is firing and working
correctly except that the javascipt pop-up doesn't come up and they
are sent directly to PageA, which is kind of what i want except i want
the popup alert to show and when they click OK, they are then
redirected to PageA.
i also tried using IsStartupScriptRegistered/RegisterStartupScript
first, same thing happens.
adding the onClick attribute to the button doesn't make much sense
here as they have already clicked the button to get into this
function. i put that in just because i saw it on web page out there.
basically trying to figure out how to kick off this javascript
conditionally. don't want it to popup/redirect if my IF condition is
false. but its not firing at all at this point.
thanks for any help!!