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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asp.net Datagrid with checkbox

Status
Not open for further replies.

newbie14

Technical User
Feb 14, 2009
81
MY
Dear All,

I have query here simple one with name and status field. So what I need is a datagridview which must have a column for checkbox. The problem here is that based on each row of my data I will check for my status field it is "y" then I want to check the box else box is empty. This process should happen when I am binding the data to my datagrid. I was trying something like in windows application menuAuthorisation.Rows.Add but is not recognise in asp.net. Can any one help me on this please? Thanks.
 
I normally do this with a template field, and evaluate the relevant boolean expression from my datasource:
Code:
                    <asp:TemplateField>
                        <ItemTemplate><asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("status")=="y" %>' Enabled="false" /></ItemTemplate>
                    </asp:TemplateField>

~LFCfan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top