Binding custom data object to checkbox list?

Discussion in 'ASP .Net' started by cannontrodder, Aug 15, 2006.

  1. I am displaying names and other details of my users in a Formview
    control by binding my custom business object to it. My custom object
    also has a property that is a collection of boolean values and I would
    like to show a checkboxlist within my formview to represent them.

    I just have no idea how to bind this collection to a list within the
    formview? Has anyone got any ideas on this? I don't need the full code,
    just a pointer in the right direction!
    cannontrodder, Aug 15, 2006
    #1
    1. Advertising

  2. cannontrodder

    Islamegy® Guest

    first why do u bind checkboxlist to collection of boolean?! those values
    will be the text or the value??
    it's meaningless as i see.

    anyway if the custom object has a property has a collection of boolean then
    bind checkboxlist to this property but this property getter do the work of
    getting these values(ex. master-details you must call fill method of the
    child)..

    objectDataSource won't be able to invoke fill method of the values..




    "cannontrodder" <> wrote in message
    news:...
    >I am displaying names and other details of my users in a Formview
    > control by binding my custom business object to it. My custom object
    > also has a property that is a collection of boolean values and I would
    > like to show a checkboxlist within my formview to represent them.
    >
    > I just have no idea how to bind this collection to a list within the
    > formview? Has anyone got any ideas on this? I don't need the full code,
    > just a pointer in the right direction!
    >
    Islamegy®, Aug 15, 2006
    #2
    1. Advertising

  3. Well the collection indicates which roles a user is in. EG:
    roles("admin")=False

    That seems a logical way to store it internally??

    I'm having trouble following what you are saying here. This is my
    declaritive code:

    <asp:Label runat="server" Text='<%# Eval("Username") %>' />
    <asp:Label ID="Label5" runat="server" Text='<%# Eval("Email") %>' />
    <asp:Label ID="Label6" runat="server" Text='<%# Eval("Firstname") %>'
    />
    <asp:Label ID="Label7" runat="server" Text='<%# Eval("Lastname") %>' />

    <asp:CheckBoxList ID="CheckBoxList1" runat="server" />

    Username, Email, Firstname, Lastname and UserRoles are all members of
    the data object that the formview is bound to. I just can't see how I
    would declaratively bind that collection in the CheckBoxList tag above?


    Islamegy® wrote:
    > first why do u bind checkboxlist to collection of boolean?! those values
    > will be the text or the value??
    > it's meaningless as i see.
    >
    > anyway if the custom object has a property has a collection of boolean then
    > bind checkboxlist to this property but this property getter do the work of
    > getting these values(ex. master-details you must call fill method of the
    > child)..
    >
    > objectDataSource won't be able to invoke fill method of the values..
    >
    >
    >
    >
    > "cannontrodder" <> wrote in message
    > news:...
    > >I am displaying names and other details of my users in a Formview
    > > control by binding my custom business object to it. My custom object
    > > also has a property that is a collection of boolean values and I would
    > > like to show a checkboxlist within my formview to represent them.
    > >
    > > I just have no idea how to bind this collection to a list within the
    > > formview? Has anyone got any ideas on this? I don't need the full code,
    > > just a pointer in the right direction!
    > >
    cannontrodder, Aug 15, 2006
    #3
  4. Ah, looks like I need to use the colelction syntax:

    http://support.microsoft.com/?id=307860


    cannontrodder wrote:
    > Well the collection indicates which roles a user is in. EG:
    > roles("admin")=False
    >
    > That seems a logical way to store it internally??
    >
    > I'm having trouble following what you are saying here. This is my
    > declaritive code:
    >
    > <asp:Label runat="server" Text='<%# Eval("Username") %>' />
    > <asp:Label ID="Label5" runat="server" Text='<%# Eval("Email") %>' />
    > <asp:Label ID="Label6" runat="server" Text='<%# Eval("Firstname") %>'
    > />
    > <asp:Label ID="Label7" runat="server" Text='<%# Eval("Lastname") %>' />
    >
    > <asp:CheckBoxList ID="CheckBoxList1" runat="server" />
    >
    > Username, Email, Firstname, Lastname and UserRoles are all members of
    > the data object that the formview is bound to. I just can't see how I
    > would declaratively bind that collection in the CheckBoxList tag above?
    >
    >
    > Islamegy® wrote:
    > > first why do u bind checkboxlist to collection of boolean?! those values
    > > will be the text or the value??
    > > it's meaningless as i see.
    > >
    > > anyway if the custom object has a property has a collection of boolean then
    > > bind checkboxlist to this property but this property getter do the work of
    > > getting these values(ex. master-details you must call fill method of the
    > > child)..
    > >
    > > objectDataSource won't be able to invoke fill method of the values..
    > >
    > >
    > >
    > >
    > > "cannontrodder" <> wrote in message
    > > news:...
    > > >I am displaying names and other details of my users in a Formview
    > > > control by binding my custom business object to it. My custom object
    > > > also has a property that is a collection of boolean values and I would
    > > > like to show a checkboxlist within my formview to represent them.
    > > >
    > > > I just have no idea how to bind this collection to a list within the
    > > > formview? Has anyone got any ideas on this? I don't need the full code,
    > > > just a pointer in the right direction!
    > > >
    cannontrodder, Aug 15, 2006
    #4
    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. Alan Silver

    How do I do data binding with a checkbox?

    Alan Silver, Feb 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    463
    Alan Silver
    Feb 22, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,383
    ThunderMusic
    Jan 25, 2006
  3. =?Utf-8?B?SmF5YnVmZmV0?=
    Replies:
    9
    Views:
    848
    Phillip Williams
    Feb 21, 2006
  4. JcFx
    Replies:
    0
    Views:
    276
  5. vineetbatta

    Binding data to Grid control with CUSTOM DATA CLASS

    vineetbatta, Oct 16, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    756
    vineetbatta
    Oct 16, 2006
Loading...

Share This Page