Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Confirmation for asp.net in vb?

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-22 : 14:10:38
Does anyone know of a confirmation popup for asp.net in vb? I found most of them in c# but I'm doing my page in vb. I want to confirm to the user if they want to submit the data to be saved or not.

Please advise. Thanks.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-22 : 14:35:10
you mean on the client side?
javascript:alert('message goes here')

Go with the flow & have fun! Else fight the flow
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-22 : 17:49:50
Yes client side, but that's not what I'm looking. I need a confirmation like "Yes" or "No". If the user clicks on the "Yes" popup dialog box, then go and execute the code behind, else don't.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-23 : 06:23:31
http://www.devguru.com/technologies/wml/vbscript/quickref/msgbox.html

but you have to realise that to execute code behind you must do a postback. you can do that with javascript or vbscript.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-23 : 12:44:51
Thanks, that's what I need. It doesn't show if I click on cancel to abort it. Even if I click on cancel, it still goes ahead and save the data. Any ideas?
Go to Top of Page

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2005-03-23 : 13:01:38
Use the confirm javascript function on your button click event handler.

if(document.getElementByID)
window.onload = load;

function load()
{
if(document.getElementById("<Your submit button id>") != null)
document.getElementById("<Your submit button id>").onclick = confirmSubmit;
}

function confirmSubmit()
{
return confirm("Are you sure you really want to submit this information?");
}


Whenever your submit button is clicked it will pop up the confirm box. If the user clicks yes then a value of true will be returned which will go ahead and submit the form. If the user clicks no then a value of false will be returned and the page will not be submitted.

Dustin Michaels
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-03-23 : 16:44:31
Thanks Dustin. Exactly what i need.

Thanks again.
Go to Top of Page
   

- Advertisement -