开发者

Is there a way to NOT load a specific control in ASP.NET/C#?

I've a container (RadDockZone - Telerik), and inside it, a textbox field with an "Asp:RequiredFieldValidator", which makes it mandatory. Every time that I work with AJAX operations, the entire container is "reloaded", in开发者_运维知识库cluding the RequiredFieldValidator. This makes the ValidationSummary show the same error message twice, until the page is completely reloaded (I'm using RadAjaxManager to solve the AJAX operations).

So, how can I "don't reload" a specific control (in this case, the RequiredFieldValidator) using C#?

Regards!


If you place the following in page load if(page.Isvalid) the required field validator will be fired once after submitting that form. The message will not be displayed twice.


If you do not include the textbox (or its wrapping containers) in the list of controls updated by the ajax manager, the textbox and the respective required validator should not be updated on ajax requests and the error message should not be visualized.


You should use validation groups. This lets you group all of your validation controls into a group. Then put this same validation group on your submit button and those validation controls will only validate when that particular button is clicked.

Property is assigned on the validation control and button using the ValidationGroup property.

Thomasvdb's suggestion of setting CausesValidation to false also might be a good way to do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜