用DATAGRID捆绑数据时,我如何通过CheckBob来进行选择删除?请求解决..... foreach(DataGridItem m_item in this.DataGrid2.Items) { if(((CheckBox)m_item.Cells[0].FindControl("cb")).Checked==true) { } } 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果你的book_id列的<ItemTemplate>是这样定义的:<ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "book_id") %></ItemTemplate>那么:Label DelID = (Label) book.Items[i].FindControl("DelID");-->string book_id = book.Items[i].Cells[n].Text; //n为你的book_id的列的序号string IDSql="delete from book where book_id="+book_id; <asp:TemplateColumn><HeaderStyle Width="4%" BackColor="#CCCC66"></HeaderStyle><ItemTemplate><asp:CheckBox ID="Remove" Runat="server" /><asp:Label Visible="False" ID="DelID" Runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.book_id") %>'></asp:Label></ItemTemplate></asp:TemplateColumn>我的book_id是上面的:可是你的方法还是不可以还有什么解决方案吗? 多谢 seesea125(雨天) 你的方法我测试通过了再次感谢! DropDownList的一个小问题。。。。!!!!!!!!!!! 用ASP.NET和access 做的动态网站上传后打不开如何修改Web.confing 快来看看!取值问题 数据查询问题 xp系统中的这个aspnet_wp.exe进程怎么不好使 提个简单基础的问题,望大家帮忙解惑 怎样控制ImageButton的onclick? 请哈尔滨前辈推荐个.net学校、机构、个人 如何办? 使用ASP.NET需要什么开发工具?我不想完全安装完整的VS.NET 请问如何在一个网页内包含另一张C#写的网页的内容? 请问在mainframe要取leftframe中的参数怎么做???!!急!
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "book_id") %>
</ItemTemplate>那么:
Label DelID = (Label) book.Items[i].FindControl("DelID");
-->
string book_id = book.Items[i].Cells[n].Text; //n为你的book_id的列的序号
string IDSql="delete from book where book_id="+book_id;
<HeaderStyle Width="4%" BackColor="#CCCC66"></HeaderStyle>
<ItemTemplate>
<asp:CheckBox ID="Remove" Runat="server" />
<asp:Label Visible="False" ID="DelID" Runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.book_id") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>我的book_id是上面的:
可是你的方法还是不可以
还有什么解决方案吗?
你的方法我测试通过了
再次感谢!