Hi Tom,
You could try something like this:
In your code behind put this in your declarations:
Protected WithEvents hidGlobal As System.Web.UI.HtmlControls.HtmlInputHidden
Change your onclick Attribute:
myNextButton.Attributes.Add("onclick", "return MyConfirm();")
Assign your global variable to the hidden field:
hidGlobal.Value = CStr(theglobalvariable)
Now in your .aspx page do this:
Add the input tag:
<input type="hidden" id="hidGlobal" name="hidGlobal" runat="Server">
Then add the JavaScript function:
function MyConfirm() {
if (document.getElementById("radiobuttonid").checked == true) {
if (document.getElementById("hidGlobal").value == "what it should")
{
return confirm('Are you sure you want finish this test?');
}
}
return false;
}
You'll probably need to change that around to correspond to the correct
logic for your radio buttons and global variables but that should set you on
the right track to accomplish what you are trying to do. If you have
anymore questions fire away and watch out for any typos I might've made.
Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I don't know if this can be done. It is a coordination with my client
side vs my server side code.
I can create a popup fine:
Dim myNextButton As ImageButton =
CType(DataList1.Controls(DataList1.Controls.Count-1).FindControl("DownQuesti
on"),ImageButton) myNextButton.Attributes.Add("onclick", "return confirm('Are you sure
you want finish this test?');")
This will put a popup on my button that will get processed before the page
posts. If they say "yes" the post happens, if "no", it doesn't.
If it posts, I am going to hide part of the page and show a
congratulations message.
My problem is that I need to check to see if a radiobutton has been
pressed first and one of my global values is set. This means I need to go to my
server side code to check this out and it is too late to attach the popup
to my button as it has already been pushed and the page is already in
postback mode.
Is there a way to do this?
Thanks,
Tom