I want to show the text along with checkbox in every cell in checkbox column in a datagridview.Is it possible?If it is,Please help me with the sample code.
Thanx in adva开发者_高级运维nce
I want in c# please.
Try something as below for the text of checkbox
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkStatus" runat="server"
AutoPostBack="true" OnCheckedChanged="chkStatus_OnCheckedChanged"
Checked='<%# Convert.ToBoolean(Eval("Approved")) %>'
Text='<%# Eval("Approved").ToString().Equals("True") ? " Approved " : " Not Approved " %>' />
</ItemTemplate>
</asp:TemplateField>
Code behind
((CheckBox)e.Row.FindControl("chkStatus")).Text="abc";
精彩评论