0

谁能帮我?

我有问题。当更改 Telerik 的 radcombobox 时,验证文本框句柄。但我希望仅在单击时进行验证处理button1

以下代码:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting  AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                        <telerik:AjaxUpdatedControl ControlID="Label1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" runat="server" DataSourceID="SqlDataSource1" DataTextField="cg_id" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"></telerik:RadComboBox>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>" SelectCommand="SELECT * FROM [Categorys_Group]"></asp:SqlDataSource>
            </asp:Panel>
        <telerik:RadTextBox ID="RadTextBox1" runat="server"></telerik:RadTextBox>
        <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="Dynamic"
                    ControlToValidate="RadTextBox1" ErrorMessage="Không được để trống!" ForeColor="Red"></asp:RequiredFieldValidator>

后面的代码:

protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            Label1.Text = RadComboBox1.SelectedIndex.ToString();
        }

现在,我想在更改 RadComboBox1 验证时,TextBoxRequiredFieldValidator不要处理。它仅在单击按钮时处理。

我该怎么办?谢谢帮帮我!

4

2 回答 2

0

请尝试以下代码片段。

<telerik:RadComboBox CausesValidation="false" ID="RadComboBox1" AutoPostBack="true" runat="server" DataSourceID="SqlDataSource1" DataTextField="cg_id" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"></telerik:RadComboBox>
于 2013-07-13T09:49:41.780 回答
0

现在,我知道该怎么做了。

我添加 ValidationGroup="SelectionFormValidationGroup"了控件验证。

于 2013-07-14T13:49:28.953 回答