开发者

showing text along with checkbox in checkbox column in datagridview

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";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜