datagrid专栏2
来源:互联网 发布:java classpath linux 编辑:程序博客网 时间:2024/06/13 01:07
一。this.btnDelete.Attributes.Add("onclick","return confirm('确定要删除么?')");
BLL.Product product = new admin.BLL.Product();
foreach(DataGridItem dgItem in this.DataGrid1.Items)
{
CheckBox chk = (CheckBox)dgItem.FindControl("chkDelete");
if(chk.Checked ==true)
{
product.DeleteProduct(dgItem.Cells[0].Text);//dgItem.Cells[0].Text获取指定单元格的数据,必须是绑定列
}
}
this.BindGrid();
二。for (int i=0; i < this.dgCart.Items.Count; i++)
{
// 找到某行的数量信息和删除信息。
TextBox quantityTxt = (TextBox) dgCart.Items[i].FindControl("Quantity");
CheckBox remove = (CheckBox) dgCart.Items[i].FindControl("Remove");
// 出错处理。防止用户的非法输入,如quanlity为负数等
int quantity;
try
{
quantity = Int32.Parse(quantityTxt.Text);
// 如果数量被修改或者Remove复选框被选中
if((quantity != Convert.ToInt32(dgCart.DataKeys[i])) || (remove.Checked == true))
{
Label lblBookID = (Label) dgCart.Items[i].FindControl("bookID");
//数量为0或用户选择删除
if (quantity == 0 || remove.Checked == true)
{
cart.DeleteItem(cartID, Int32.Parse(lblBookID.Text));
}
else
{
cart.UpdateItem(cartID, Int32.Parse(lblBookID.Text),quantity);
}
}
}
catch
{
lblError.Text = "对不起,您的输入信息有误!";
}
}
三。获取摸板列中的控件
(类型)e.Item.FindControl("TextBox1");//在知道控件名的情况下
(类型)e.Item.Cell[2].Control[0]
- datagrid专栏2
- DataGrid 专栏
- DataGrid 专栏
- datagrid专栏1(分页)
- 一个功能齐全的DataGrid分页例子 -------------bluemoon213的专栏
- Struts 2 的专栏
- 专栏
- 转载: 愚翁专栏 探讨DataGrid的几种分页方法的优劣
- C专栏2-工具与历史
- 【Alex专栏】Kinect应用设计2
- (高质量代码专栏)第二章-2
- 悟空学Linux专栏----第2篇
- Flex 2 DataGrid 分页
- DataGrid
- datagrid
- DataGrid
- datagrid
- datagrid
- .NET常用功能和代码
- datagrid专栏1(分页)
- 为WINDOWS XP减肥
- asp.net生成缩略图及给原始图加水印
- 《大道至简》的幕后故事(4):“愚公移山记”军事地理篇
- datagrid专栏2
- 用SQLDMO在ASP.NET页面下实现数据库的备份与恢复
- asp.net在线备份SQL Server数据库
- 回答看完《心情随笔》的朋友最关心的问题。
- Prototype 1.5 Ajax 使用教程
- 开博篇
- 无题,晕~
- 菜鸟谈左右法则
- 转帖:回车和换行的区别