Environment versions
Network:
Windows 2000 Server
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only