Validation on javascript in button and post back if it returns true

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muthukumaran08
    New Member
    • Sep 2010
    • 4

    #1

    Validation on javascript in button and post back if it returns true

    I have textboxes and dropdownlist on my page. And i have image button when i click this image button i m validating textboxes on javascript and if it returns true, i need to do a post back to save the values. If it is returns false it should not post back.

    Please do help me on this.
  • ZiadElmalki
    New Member
    • Sep 2010
    • 43

    #2
    You can use the OnClientClick property. Return false to cancel the submit.

    <asp:Button
    runat="server"
    Text="Ok"
    OnClientClick=" javascript:retu rn confirm('Do you want to submit?');" />

    Comment

    Working...