Composite DropDownList Databinding issue

Discussion in 'ASP .Net Building Controls' started by NiXHex, Oct 25, 2005.

  1. NiXHex

    NiXHex Guest

    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?
     
    NiXHex, Oct 25, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sleigh
    Replies:
    1
    Views:
    2,694
    sleigh
    Feb 12, 2004
  2. Charlie@CBFC
    Replies:
    1
    Views:
    534
    Teemu Keiski
    Oct 9, 2005
  3. tshad
    Replies:
    8
    Views:
    2,236
    tshad
    Oct 19, 2005
  4. Chad
    Replies:
    0
    Views:
    225
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    266
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page