Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bound checkbox in a DataGrid
Message
De
15/10/2008 08:48:04
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
15/10/2008 05:06:55
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01354896
Message ID:
01355098
Vues:
22
>>I guess I haven't tried to do this before. I would like to display a boolean field in a data grid with a checkbox. I added a checkbox type column to the grid and bound it to a boolean field but it just shows up as dimmed out. What is the process for doing this?
>>
>
>well, checkbox type columns show up as dimmed out (in other words: disabled or readonly) like any other column in the grid
>If you want it to be enabled, you need to "Edit" that particular row!
>As an alternative, you can create a template column with a bound checkbox inside. In this case, all checkboxes in this columns show up as enabled, but you have to care about saving the checked status changings on your own.

You are right and they look terrible being so dimmed you can hardly tell if they are checked or not. I think I may have figured out why I was getting a bad result appearing to not be bound at all. I do not like them however in this very dimmed state. I do not need to edit any rows in this situation however.
>
>>How about if I want to display an enumeratin value that corresponds to an integer in the data within a datagrid? So if I have a type column that can be a 0, 1, or 2 value but I want to display in the datagrid "Message", "Tip", "Location".
>
>if you simply want to display these values, you can (again) create a template column with no control inside.
>In the RowDataBound event of the gridview, you can modify the "Text" property of the "cell" in that particular column.

Thanks, I am going to give this a try today just so I know how to do this.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform