|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passing data into a custom controlI made a custom web control (ascx) that contains a bound gridview in a
scrolling panel with a datasource control. This control will be used by several pages in my site. Each time it is used a different SQL query (filter) is required. Now the sqldatasource.selectcommand has the filter hardcoded into the ascx file. I know this is bad. How can I change the sqldatasource's selectcommand property dynamically from the pages that will contain my custom control? The best way is to make a public property or method in the control which
sets the value in the subcontrol. The page can then call the public property or method. Here's more detail: http://SteveOrr.net/faq/PassDataToUserControl.aspx Show quoteHide quote "Steve" <Steve@nospam.com> wrote in message news:OAjmJROWGHA.2180@TK2MSFTNGP02.phx.gbl... >I made a custom web control (ascx) that contains a bound gridview in a >scrolling panel with a datasource control. This control will be used by >several pages in my site. Each time it is used a different SQL query >(filter) is required. Now the sqldatasource.selectcommand has the filter >hardcoded into the ascx file. I know this is bad. How can I change the >sqldatasource's selectcommand property dynamically from the pages that will >contain my custom control? >
"Cannot have multiple items selected in a DropDownList" Error
edit attribute values of a web control just before control rendered to the page (control's Load even events inheritance RE: Checkbox data binding on Checked property Accessing FormView template controls clicked event never fires Atlas UpdatePanel with Webparts validating user control How to reach the object connected to repeater Dynamically move control. |
|||||||||||||||||||||||