日期:2014-05-18  浏览次数:20474 次

关于GridView的checked列的更新问题
我在HTML里的代码如下:
<asp:TemplateField   HeaderText= "选取 "   SortExpression= "isFriend ">
                                        <EditItemTemplate>
                                                <asp:CheckBox   ID= "CheckBox2 "   runat= "server "   Checked= ' <%#   Bind( "isFriend ")   %> '   />
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                                <asp:CheckBox   ID= "CheckBox2 "   runat= "server "   Checked= ' <%#   Bind( "isFriend ")   %> '   Enabled= "false "   />
                                        </ItemTemplate>

                                </asp:TemplateField>
---------------------------------------------------
CS代码:
string   isFriend   =   ((TextBox)GridView1.Rows[e.RowIndex].FindControl( "isFriend ")).Text;
呵呵,复选框是不是不应该用TextBox转呐?我的数据库这个字段是bit型的,请问怎么更新呀,选中后该字段就为1

------解决方案--------------------
gridview可以设置其emptydatatemlate,右键选择一下,然后你就设置该模版就ok了