When adding WHERE-clause parameters in a DataSource, you can specify an existing form control (textbox, dropdown, etc) by selecting “Source: Control” and then picking the “ControlID” from the next dropdown.
Is there some way to configure a user control so it will appear in the Controls list?
OR
How can I use a property of the user control as a query parameter?
I’m not sure if you can do that with
System.Web.UI.UserControl, but I was able to do it withSystem.Web.UI.WebControls.WebControl.You have to mark your WebControl class as
[ControlValueProperty("PropertyName")].PropertyName is the name of the property who’s value will be used in the where clause. For eg- in case of TextBox it’s “Text”, in case of DropDownList it’s “SelectedValue”
I tried doing this with UserControl but couldn’t make it work, will let you know if I find a solution.