Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What control would be best to display descrip+checkbox
Message
From
20/03/2006 09:36:52
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
20/03/2006 08:53:59
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01105792
Message ID:
01105819
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
>I return data from a query with a list of item descriptions and a boolean column to check on or off.
>
>I need to display these (list could be anywhere from 2 to 100 items long) in an ASP.NET page in order for the user to check on or off as desired. I need this to be done in one step, IOW not a round-trip for every click. The Controls have to be a label (R/O for the description and a simple graphical checkbox for on/off).
>
>I tried a DataList but it only allows a linkbutton or imagebutton to be clicked on and trigger an event. They generate a roundtrip for each click (not what is desired).
>
>I tried a GridView control but it requires to change to edit mode on the ItemTemplate/EditTemplate for each item, generating a round trip for each.
>
>I am now trying/learning with a repeater control. I get Descrip/True in each table row but I'm not sure how to display the boolean in a clickable checkbox.
>
>I need to be able to click on or off at the users desire then press submit top be able to traverse the DatSet (Datatable) and see how many where checked on or off. This part should be easy if I could do the display properly.
>
>What control is best for this task? Can you point to any samples out there?
>
>TIA

Alex,

There isn't really anything magical about any of the .NET controls. Fundamentally, the container controls all work the same way (DataGrid, DataList, Repeater).

You can use a checkbox without an immediate post-back. Before re-binding the list, in the Submit button's click handler, iterate through the rows of the list control (DataGridItem, DataListItem, RepeaterItem) checking the checkbox in each row and updating the datasource as needed.

To make this easier, be sure to include the PK of the datasource in a column as a non-visible label and get the value from it at the same time that you get the value of the checkbox.
Previous
Reply
Map
View

Click here to load this message in the networking platform