SQLDataSource parameter referencing a text box in a user control?

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
 
G

Guest

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

ControlID="mycontrol$cboProjects"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top