I have a submit button on a form that I want to first do the validation and if valid call a client side javascript function and then run through its click event handler
currently I have this set up by adding this line in the Page_Load
mybutton.Attributes.Add("onclick", "javascript:ShowRunningDialog(this);");
But if the page is not valid I don't want to call this client side function. As it is now the 'ShowRunningDialog' is obviously going to be called no matter what
![]() |
0 |
![]() |
if (Page.IsValid) mybutton.Attributes.Add("onclick", "javascript:ShowRunningDialog(this);");
Was that what you meant?
Please Mark As Answer posts that helped you.
"If we learn from our mistakes, I should be brilliant by now."
![]() |
0 |
![]() |
Duh. Perfect. Thanks.
![]() |
0 |
![]() |
You still need to post back which is unnecessary. This can be done using all JavaScript see the following:
function ShowValid()
{
ValidatePage();
if(Page_IsValid)
//Do Something
else
return false;
}
![]() |
0 |
![]() |