473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Checkbox and dropdownlist row in repeater row

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
Mar 23 '06 #1
2 3690
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

Mar 23 '06 #2
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

Mar 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: kamaumalone | last post by:
I have a dropdownlist which lives inside of a repeater. The repeater accepts user input via textboxes and the aforementioned dropdownlist. The repeater accepts phone numbers and allows for an...
2
by: Thomas R | last post by:
Is is possible? In VS.NET 2003, Binding data to the repeater is easy, but when I try to add an ASP:checkbox to the .aspx page, the designer won't recognize it, hence the code view doesn't allow...
1
by: Shaun Camilleri | last post by:
Hi all, I am creating a DropDownList in a RepeaterControl. After the Repeater is DataBound in the ItemCreated event (of the Repeater) I bind the DropDownList to a Table and then try to select one...
2
by: Alan Silver | last post by:
Hello, I have a repeater with a list of products in it. Each item in the repeater has a checkbox, allowing the product to be selected. When a link button is clicked, I want to loop through the...
2
by: Andrew | last post by:
Hi, I have a problem capturing the checkboxes that are checked, I get false irrespective of wether they are checked or not. I have gone thru the sample code on this forum, but they dun seem to...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: jjack100 | last post by:
I have a DropDownList that is nested inside a Repeater. The datasource of the DropDownList is declared in the aspx, not the codebehind. So we have this: <asp:Repeater ID="rptOptions"...
1
by: Eugene Anthony | last post by:
ModifyUserRegistration.aspx --------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModifyUserRegistration.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC...
3
by: Mahathi | last post by:
Hi I have a small problem in maintaining the state of a check box. Please do me a favour by telling me the procedure how to do that. My requirement is that "I have to map some roles with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.