different message for requiredfieldvalidator

Results 1 to 4 of 4

Thread: different message for requiredfieldvalidator

  1. #1
    Join Date
    Dec 1969

    Default different message for requiredfieldvalidator

    I have one textbox control and i have two buttons on same page.<BR>There is one requiredfieldvalidator control which is bind with this text box.<BR>Now what i want when somebody clicks on first button the error message shud be different with when somebody click on second button.<BR>

  2. #2

    Default RE: different message for requiredfieldvalidator

    There is no easy way to do this on the client, make the validation server-side and change which validator is enabled in the event handler, then call page.validate

  3. #3
    Join Date
    Dec 1969

    Default tried at serever side

    i tried at the server side but everytime i get an error stating that "object reference has not set" inspite of creating new requiredfieldvalidator object and associated with textbox<BR><BR>i was not able to proceed further.<BR><BR>

  4. #4

    Default RE: tried at serever side

    Just put the controls and validators in the html, don&#039;t create them in code.<BR><BR>Set the enableClientScript of the validators to false.<BR>Set the enabled property to false;<BR><BR>When a button is clicked, set the enabled property of the appropriate validator to true ,call Page.Validate() then check Page.IsValid before doing the real buisness.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts