Checkbox and dropdownlist row in repeater row

Discussion in 'ASP .Net' started by =?Utf-8?B?UmljaGFyZEg=?=, Mar 23, 2006.

  1. Hi,

    I have x number of table rows that all should have a checkbox and a
    dropdownlist on each row. The checkbox could be checked and the dropdown
    should contain y number of values that are related to the row. I can't find a
    good control for this in ASP.Net 2.0.

    Now I use a repeater and check the checkbox on ItemDataBound, I also fill
    the dropdown on this event. My first problem is that i find this event very
    messy. I have to cast between different types because of the repeater
    (dataitem, row etc). I also have to check for the right ListItemType and so
    on ... However this could be OK. But the big challenge occurs when I'm about
    to write the edited data back to the database. I have a save button. On the
    postback that fires when i push this i then have go to the repeater and get
    all it's controls. Loop these (all the repeaters rows) and find my controls
    by there id to finally find out if a checkbutton has changed value or a
    different selection on the dropdown has been selected.

    I hope someone has a better idea to solve this. Is there a better suited
    control i missed or could i use the repeater differently?

    Thanks in advance

    Richard
    =?Utf-8?B?UmljaGFyZEg=?=, Mar 23, 2006
    #1
    1. Advertising

  2. I would use a GridCiew control bound to one of the ASP,net 2.0 Data source
    controls like the SQLDataSource control. You can then use TemplateFields for
    the columns, and put you DDL and checkbox controls in the TemplateFields and
    bind them using <%# bind("FieldName") %> to whtever property of the control
    you wish. This way you can retrieve, add, update and delete data with little
    or no code.


    "RichardH" wrote:

    > Hi,
    >
    > I have x number of table rows that all should have a checkbox and a
    > dropdownlist on each row. The checkbox could be checked and the dropdown
    > should contain y number of values that are related to the row. I can't find a
    > good control for this in ASP.Net 2.0.
    >
    > Now I use a repeater and check the checkbox on ItemDataBound, I also fill
    > the dropdown on this event. My first problem is that i find this event very
    > messy. I have to cast between different types because of the repeater
    > (dataitem, row etc). I also have to check for the right ListItemType and so
    > on ... However this could be OK. But the big challenge occurs when I'm about
    > to write the edited data back to the database. I have a save button. On the
    > postback that fires when i push this i then have go to the repeater and get
    > all it's controls. Loop these (all the repeaters rows) and find my controls
    > by there id to finally find out if a checkbutton has changed value or a
    > different selection on the dropdown has been selected.
    >
    > I hope someone has a better idea to solve this. Is there a better suited
    > control i missed or could i use the repeater differently?
    >
    > Thanks in advance
    >
    > Richard
    =?Utf-8?B?Y2xpY2tvbg==?=, Mar 23, 2006
    #2
    1. Advertising

  3. Ok, thanks I'll look in to that once again.

    But the data for listing all the dropboxes comes from one place (could be
    1-5 boxes). Then I have a another source that have all the selected id's (if
    the box should be cheked). The DDL are also filled with values from a third
    source. Will this work with the GridView? Can I override the dataitembound
    and check the right box?

    Richard

    "clickon" wrote:

    > I would use a GridCiew control bound to one of the ASP,net 2.0 Data source
    > controls like the SQLDataSource control. You can then use TemplateFields for
    > the columns, and put you DDL and checkbox controls in the TemplateFields and
    > bind them using <%# bind("FieldName") %> to whtever property of the control
    > you wish. This way you can retrieve, add, update and delete data with little
    > or no code.
    >
    >
    > "RichardH" wrote:
    >
    > > Hi,
    > >
    > > I have x number of table rows that all should have a checkbox and a
    > > dropdownlist on each row. The checkbox could be checked and the dropdown
    > > should contain y number of values that are related to the row. I can't find a
    > > good control for this in ASP.Net 2.0.
    > >
    > > Now I use a repeater and check the checkbox on ItemDataBound, I also fill
    > > the dropdown on this event. My first problem is that i find this event very
    > > messy. I have to cast between different types because of the repeater
    > > (dataitem, row etc). I also have to check for the right ListItemType and so
    > > on ... However this could be OK. But the big challenge occurs when I'm about
    > > to write the edited data back to the database. I have a save button. On the
    > > postback that fires when i push this i then have go to the repeater and get
    > > all it's controls. Loop these (all the repeaters rows) and find my controls
    > > by there id to finally find out if a checkbutton has changed value or a
    > > different selection on the dropdown has been selected.
    > >
    > > I hope someone has a better idea to solve this. Is there a better suited
    > > control i missed or could i use the repeater differently?
    > >
    > > Thanks in advance
    > >
    > > Richard
    =?Utf-8?B?UmljaGFyZEg=?=, Mar 24, 2006
    #3
    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. Mark
    Replies:
    2
    Views:
    901
    Steven Cheng[MSFT]
    Jan 27, 2004
  2. simon

    Checkbox and repeater

    simon, Nov 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,082
    simon
    Nov 12, 2004
  3. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    779
    David Wier
    Oct 6, 2006
  4. Replies:
    0
    Views:
    849
  5. Jason Huang
    Replies:
    0
    Views:
    522
    Jason Huang
    Jun 29, 2007
Loading...

Share This Page