Checkbox and dropdownlist row in repeater row

G

Guest

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
 
G

Guest

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.
 
G

Guest

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
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top