Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting DataGrid Checkbox Control 1

Status
Not open for further replies.

JGresko

Programmer
Apr 24, 2002
86
US

I have a checkbox in a datagrid and I want it to show checked for active records (denoted by a Y in the active column of my database). How do I get the Y to check the checkbox?

Thanks in advance,

Judy
 
check out faq855-2613

It is easily modified to return a boolean. In the conditions just specify to return true if the string is "Y" and False if anything else. The line for the datagrid column changes in that you use the checked property instead of the text one for a text box as is shown. Other than that it is the exact same concept. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Got it, Thanks !

I changed the datafield to hold "True" or "False"

<asp:CheckBox id=ckActive runat=&quot;server&quot; checked='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,&quot;Active&quot;)) %>'></asp:CheckBox>
 
Glad I could help Judy thanks for the star. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top