CustomValidator in Datagrid ItemTemplate


  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.

LVL 2
dlarlickAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ryerrasCommented:
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

http://www.codeproject.com/aspnet/validationsummary.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dlarlickAuthor Commented:

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



     
0
dlarlickAuthor Commented:

  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!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.