check Validation of a cotrol from code behind - causing to show Validator Text
hi my dear friends :
i have a button with CausesValidation Property to false... it's code like below : <telerik:RadButton ID="RadbtnViewImage" runat="server" Text="view" CausesValidation="False" EnableEmbeddedSkins="False" Skin="BlackByMe" Font-Names="Tahoma" Width="80px" onclick="RadbtnViewImage_Click">
</telerik:RadButton>
also i have a RadComboBox with a CostumValidator that is in relationship with that RadComboBox...
it's code like below :<div class="EditRow">
<div class="RightEditColumn">
imageGroupName
</div>
<div class="LeftEditColumn">
<telerik:RadComboBox ID="RadcbImageGroupInrpvEdit" runat="server" DataSourceID="sdsImagesGroup"
DataTextField="Title" DataValueField="ID" EnableEmbeddedSkins="False" Skin="BlackByMe2"
AppendDataBoundItems="True" MarkFirstMatch="True" LoadingMessage="loading...."
CausesValidation="False" ValidationGroup="B">
<Items>
<telerik:RadComboBoxItem runat="server" Text="plz select one" Value="0" />
</Items>
</telerik:RadComboBox>
</div>
<div class="ValDivInrpvEdit">
<div style="display: inline;">
<span id="spnOfcvImageGroupInrpvEdit" class="ttTarget">
<asp:CustomValidator ID="cvImageGroupInrpvEdit" runat="server" ControlToValidate="RadcbImageGroupInrpvEdit"
Display="Dynamic" ValidationGroup="B"
onservervalidate="cvImageGroupInrpvEdit_ServerValidate">
<span class="imgValContainerInrpvEdit">
<asp:Image ID="img4cvImageGroupInrpvEdit" CssClass="imgValidateInrpvEdit" runat="server" AlternateText="attention"
ImageUrl="~/Images/Exclamation.png" /></span>
</asp:CustomValidator>
</span>
<div id="tt44cvImageGroupInrpvEdit" class="ttContent">
开发者_运维知识库 plz choose
</div>
</div>
</div>
</div>
when the button is clicked i just want to check only that RadCombobox Validation and show the CustomValidator Text of it to users / not the other validators !
how can i do that ?
(the other controls In my page plus that RadComboBox have a same ValidationGroup -> Mean "B")
thanks in advance
Attach a second validator for this scenario with its own distinct validation group. This way, you can fire this one validator for this specific scenario, and use the original validator to validate when the entire form is processed. Depending on how you need to validate, you can use Required (set InitialValue to the initial value of the combo), or Custom.
HTH.
精彩评论