Is it impossible to declaratively databind to user control's properties?

H

HP

Hi there

I've asked about it few times, and seen it asked more times, but no
one ever replied.

The question is: is it possible to use a control inside of user
control (eg. dropdownlist) as a control parameter for some other
datasource on a page (outside that user control) with declarative
databinding (ie. using the designer, or aspx tag syntax).

I know that I can expose public properties in user control, but they
are not visible (at least the way I tried) as a control parameters for
declarative databinding.


many thanks
HP
 
H

HP



Hi Ben

Your post is very interesting, but what I meant was something
different:

What I need is to the dropdownlists inside my user control as a
control parameters for other datasources, outside the user control.

Just like I can use SelectedValue of a dropdownlists laying on the
page as a parameters of objectDataSource (or any other datasource)
:
<asp:ObjectDataSource ID="odsTets" runat="server"
SelectMethod="TestMethod" TypeName="testType">
<SelectParameters>
<asp:ControlParameter ControlID="normalDdl1"
Name="parameterName1" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="normalDdl2"
Name="parameterName2" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>

I'd like to put those ddl's inside my user controls, define
corresponding properties in the control and use them just like before:

<asp:ObjectDataSource ID="odsTets" runat="server"
SelectMethod="TestMethod" TypeName="testType">
<SelectParameters>
<asp:ControlParameter ControlID="myUserControl"
Name="parameterName1" PropertyName="exposedProperty1" Type="String" />
<asp:ControlParameter ControlID="myUserControl"
Name="parameterName2" PropertyName="exposedProperty2" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>




thanks
HP
 
H

HP

What I need is to the dropdownlists inside myusercontrolas acontrolparameters for other datasources, outside theusercontrol.
Just like I can use SelectedValue of a dropdownlists laying on the
page as a parameters of objectDataSource (or any other datasource)
:
<asp:ObjectDataSource ID="odsTets" runat="server"
SelectMethod="TestMethod" TypeName="testType">
<SelectParameters>
<asp:ControlParameter ControlID="normalDdl1"
Name="parameterName1" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="normalDdl2"
Name="parameterName2" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>

I'd like to put those ddl's inside myusercontrols, define
corresponding properties in thecontroland use them just like before:

<asp:ObjectDataSource ID="odsTets" runat="server"
SelectMethod="TestMethod" TypeName="testType">
<SelectParameters>
<asp:ControlParameter ControlID="myUserControl"
Name="parameterName1" PropertyName="exposedProperty1" Type="String" />
<asp:ControlParameter ControlID="myUserControl"
Name="parameterName2" PropertyName="exposedProperty2" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>


I've just found that it works EXACTLY as I was supposing it should - I
juts didn't try it because when selecting control for controlparameter
in the designer, user controls are not on the list, so I thought that
it's not possible. Meanwhile, one just has to switch to
controlparameters advanced properties and then it's possible to choose
user control and it's properties as a control parameters.

thanks Ben
HP
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top