Composite DropDownList Databinding issue

N

NiXHex

Hi,

I am trying to create a composite control which inherits from
system.web.ui.webcontrols.webcontrol that contains a dropdownlist
control and some validation logic and a label for any validation
messages. I want this DropDownList to auto-populate based off of
databindings I assign to it, specifically a DataSet or DataTable. The
composite control's DropDownList is accessible via the 'DDL' property.

After dragging the composite control onto a Web Form, and also dragging
a typed dataset, I want to assign the DataSet as the DropDownList's
DataSource, however the VB.Net designer doesn't allow me to do so in
the Properties tab (The DropDownList's DataSource property is greyed
out).

I am thinking it may be easier to give the composite control the
DataSource, DataMember, DataTextField, and DataValueField properties
and let the composite control deal with the DropDownList in
CreateChildControls().

So, my question is, what designer attributes do I have to assign to
those respective properties so that VS.Net lets me assign those
properties the same way that it does with an ordinary ListControl?

I added the
<TypeConverterAttribute(gettype(System.Web.UI.Design.DataSourceConverter))>
attribute to the composite control's DataSource property, and this
_sort of_ works in VS.net, however in the ASP.Net source for the Web
Form, it creates the following:

<cc1:DropDownList id="DropDownList1" runat="server"
DataSource="Players1"></cc1:DropDownList>

I believe it should be the following instead:

<cc1:DropDownList id="DropDownList1" runat="server" DataSource="<%#
Players1 %"></cc1:DropDownList></P>

Further, this doesn't auto-populate the DataMember, DataTextField, or
DataValueField selectors in the VS.Net properties either.

Any ideas on how I can get this to work?
 

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,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top