Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


CustomValidator in Datagrid ItemTemplate

Posted on 2004-10-21
Medium Priority
Last Modified: 2012-05-05

  I have a datagrid that has two item templates,
     1.) with a drop down list
     2.) with a textbox and CustomValidator

  On the postback I am iterating through the datagrid and ensuring that the text box is filled for certian selections in the drop down list.  
  When I find one that is in error I set the custom validator as such.
  validTest.ErrorMessage = "testing summary validator";
  validTest.IsValid = false;

  Unfortunately within the datagrid the validator does not appear "*" and the summary validator does not appear with the text.

   If I use a CustomValidator in the same fashion and same section of code that resides outside of the datagrid, the validator works as I expected.

  Anyone have any thoughts on this.  

  Thanks for the read.

Question by:dlarlick
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

ryerras earned 2000 total points
ID: 12377235
Hmm. its the travesty of event modelling in asp.net. Their design is not completely fool proof. Recently I had the same problem. I was using datagrid to handle some data, then I was trying to bind server side errors to the validation summary control using the ErrorMessage property of CustomValidator. Unfortunately, it never worked.
So, I created a custom control with the guidance from the following article, it worked seemlessly. Now, my server side errors bind as expected to the validation summary. Read through the article and let me know if you have any questions. I am using the approach in this article to solve this problem, in a live application. So, trust me it works


Author Comment

ID: 12379779

  Thanks for the post.
  I will take a look later today when I have some time.  


Author Comment

ID: 12380149

  Thank you...

   Will do the trick...  I'll have to use a label next to the textbox, but I don't see any other alternatives.

   Works well and solves another issue that I had nagging me elsewhere.

   Gold Star!!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Screencast - Getting to Know the Pipeline

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question