gpt4 book ai didi

c# - ASP.NET 用户控件作为 FilterParameter

转载 作者:太空宇宙 更新时间:2023-11-03 11:48:52 27 4
gpt4 key购买 nike

在 DataSource 中添加 WHERE 子句参数时,您可以通过选择“Source: Control”然后从下一个下拉列表中选择“ControlID”来指定现有的表单控件(文本框、下拉列表等)。

有没有什么方法可以配置用户控件,使其出现在控件列表中?

如何使用用户控件的属性作为查询参数?

最佳答案

我不确定你是否可以用 System.Web.UI.UserControl 做到这一点,但我可以用 System.Web.UI.WebControls.WebControl.

您必须将 WebControl 类标记为 [ControlValueProperty("PropertyName")]

PropertyName 是属性的名称,其值将在 where 子句中使用。例如,对于 TextBox,它是“Text”,对于 DropDownList,它是“SelectedValue”

我尝试使用 UserControl 执行此操作,但无法正常工作,如果我找到解决方案,我会通知您。

关于c# - ASP.NET 用户控件作为 FilterParameter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2623195/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com