SQLDataSource parameter referencing a text box in a user control?

  • Thread starter Thread starter VB.Net Pro
  • Start date Start date
V

VB.Net Pro

I have a user control (.ascx) with a combo box in it. I place it and a
SQLDataSource control on a web form. I want a SQLDataSource parameter to
point to the combo box, but it seems that the control parameters can only see
controls in the same container.

<asp:ControlParameter ControlID="cboProjects"
Name="ProjectID" PropertyName="SelectedValue"
Type="Int32" />


The above works if cboProjects is in the same container, but not if it's in
the .ascx. I've tried various names in the ControlID value i.e.
mycontrol.cboProjects.

Is there any way to make this work? My only other idea is a hidden text
field and some code to fill it in. Not a very elegant solution, but I
haven't found anything better.

Thanks
 
I have a user control (.ascx) with a combo box in it.  I place it and a
SQLDataSource control on a web form.  I want a SQLDataSource parameter to
point to the combo box, but it seems that the control parameters can onlysee
controls in the same container.

                <asp:ControlParameter ControlID="cboProjects"
Name="ProjectID" PropertyName="SelectedValue"
                    Type="Int32" />

The above works if cboProjects is in the same container, but not if it's in
the .ascx.  I've tried various names in the ControlID value i.e.
mycontrol.cboProjects.  

Is there any way to make this work?  My only other idea is a hidden text
field and some code to fill it in.  Not a very elegant solution, but I
haven't found anything better.

Thanks

ControlID="mycontrol$cboProjects"
 
Back
Top