Results 1 to 2 of 2

Thread: validation on a user control when clicking a button on different user control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    validation on a user control when clicking a button on different user control

    Hi,

    I am maintaining page where a user control is initialized dynamically.

    The user control UC1 has a customvalidator using server side validation. When the postback is caused by a button inside the user control UC1 causes the postback, the customvalidator works fine and I get my validation results displayed. However, If I click a button located on a second user control UC2 on the main aspx page, the validation doesn t execute and I get no result validation error displayed.

    My question,
    how can I make the validation execute on the user control UC1 when the postback is caused by a button located in another user control UC2 on the main page? and how can I get the user control UC1 display the validation error message?

    p.s: Notice that I am using customvalidator on server side, not on client side
    Thanks a lot for your help.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: validation on a user control when clicking a button on different user control

    I am not 100% certain but based on my experience with validators across different controls on the same page, you can't get the validators in one control to fire from a page or another control. Instead, I have had to place a custom validator control on the page with a server side method, which in turn called a property of the 'other' control which in turn checked to see if the input in it was valid or not!

Posting Permissions

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



Click Here to Expand Forum to Full Width