radgrid 中的多重控制验证

发布于 2024-09-30 21:34:31 字数 700 浏览 1 评论 0原文

您好,我的 RadGrid 中有几个字段:

<telerik:GridTemplateColumn HeaderText="ProductName" >
<EditTemplate>
<asp:TextBox ID="info" runat="server" Text='<%# Bind("ProductName") %>' />
</EditTemplate>
   </telerik:GridTemplateColumn >
<telerik:GridDropDownColumn DataField="CategoryID" DataSourceID="SqlDataSource1"
                        HeaderText="Category" ListTextField="CategoryName" ListValueField="CategoryID"
                        UniqueName="CategoryID" ColumnEditorID="GridDropDownColumnEditor1">
 </telerik:GridDropDownColumn>

我想要在这里实现的是进行一些验证,如果下拉框中的项目设置为某个值(例如“Jam”),则表明文本框是必填字段。

我不确定如何跨这两个控件进行验证。有什么建议吗?

Hi say I have a couple of fields in my RadGrid:

<telerik:GridTemplateColumn HeaderText="ProductName" >
<EditTemplate>
<asp:TextBox ID="info" runat="server" Text='<%# Bind("ProductName") %>' />
</EditTemplate>
   </telerik:GridTemplateColumn >
<telerik:GridDropDownColumn DataField="CategoryID" DataSourceID="SqlDataSource1"
                        HeaderText="Category" ListTextField="CategoryName" ListValueField="CategoryID"
                        UniqueName="CategoryID" ColumnEditorID="GridDropDownColumnEditor1">
 </telerik:GridDropDownColumn>

What I want to achieve here is to have some validation that says the textbox is a required field if the item in the dropdown box is set to a certain value say "Jam".

I'm not sure how to do the validation across these two controls. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落墨 2024-10-07 21:34:31

不用担心,我通过在 CustomValidator ServerValidate 方法中执行几个 FindControl 命令设法解决了这个问题。

查找组合框:

((RadComboBox)((CustomValidatore)source).FindControl("TextBoxName"))

No worries, I managed to sove it by doing a couple of FindControl commands in the CustomValidator ServerValidate method.

Finding a combobox:

((RadComboBox)((CustomValidatore)source).FindControl("TextBoxName"))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文