Problem with button in asp.net

  • Thread starter Thread starter vaidas gudas
  • Start date Start date
V

vaidas gudas

Hoe to make that on pressing button he asking "yes" or "no" on the client
side, and if it is pressing "yes" further it is processing the sub
button_onClick which is on the server,
I am programming in VB.NET
 
on page load add
Button1.Attributes.Add("onclick", "return fnCheck()")
use this function on the client side
<script language =javascript >
function fnCheck()
{
if(confirm("Are You Sure"))
return true;
else
return false;
}
</script>
If you are specifically looking for a yes no dialog box then this url might be of use for you
http://www.webreference.com/dhtml/column22/js-vbNewjs.html
 
Here's some server side code that outputs javascript similar to what you are
requesting:
myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise your server code is never called in
response to the button click.
 
Back
Top