Saturday, March 10, 2012

Use Update Panel in Required Field Validator ?

The RequiredFieldValidator is one of the controls that, out of the box, do not play well with the UpdatePanel. Read this article to see an easy way to get the validators to work with updatepanels:

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx

If you are unsure how to use updatepanels:

http://www.asp.net/ajax/documentation/live/tutorials/IntroductionUpdatePanel.aspx
http://www.asp.net/AJAX/Documentation/Live/tutorials/CreatingPageUpdatePanel.aspx
http://www.asp.net/learn/ajax-videos/video-78.aspx

------------------
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


You can use a custom validator to do this, seehttp://msdn2.microsoft.com/en-us/library/s5z00s5e.aspx

Also... from this blog:http://blogs.visoftinc.com/archive/2007/09/23/asp.net-ajax--updatepanel-not-working--common-problems.aspx:

"Controls Not Compatible w/ UpdatePanel– another very common problem is with controls not operating as expected within the UpdatePanel. Looking at theUpdatePanel Control Overview in the docs, have a look at the section titled "Controls that Are Not Compatible with UpdatePanel Controls". The most common issue with controls seems to be the Validators.Looking at the docs, you can "fix" the validators by simply setting the EnableClientScript property to "false". Also there are ASP.NET AJAX compatible validators in the in the works, seeMatt Gibbs blog for more information on this."

-Damien

No comments:

Post a Comment