更新多行函数
来源:互联网 发布:淘宝开店交钱 编辑:程序博客网 时间:2024/06/07 06:25
protected void updateButton_Click(object sender, EventArgs e)
{
int rowsCount = grid.Rows.Count;
GridViewRow gridRow;
TextBox quantityTextBox;
string productId;
int quantity;
bool success = true;
// 遍历GridView中的每一行
for (int i = 0; i < rowsCount; i++)
{
// 获行当前行
gridRow = grid.Rows[i];
// 通过DATAKEYS来取行没显示出来的ID号
Id = grid.DataKeys[i].Value.ToString();
//
quantityTextBox = (TextBox)gridRow.FindControl("editQuantity");
// 转换为整形,如果输入的是非法字符Int32.TryParse返回FALSE
if (Int32.TryParse(quantityTextBox.Text, out quantity))
{
// 调用业务层的方法更新数据
success = success && BLL.UpdateItem(Id, quantity);
}
else
{
// 更新失败
success = false;
}
// 显示信息
statusLabel.Text = success ?
"<br />更新成功!<br />" :
"<br />更新失败!<br />";
}
// 重新绑定GridVIEW
PopulateGridView();
}
- 更新多行函数
- 更新函数
- 更新函数
- 更新函数
- 更新屏幕值得函数
- XSLT函数 累积更新
- cocos2dx-更新函数
- cocos2dx-更新函数
- 更新贴图函数
- fflush()函数:更新缓冲区
- java_函数_更新
- Oracle更新多行
- SQL 多行更新
- Oracle更新多行
- PHP常用函数总结(180多个)[持续更新中...]
- mysql update函数,更新数据库
- 利用mysql函数更新memcached
- mssql 中的函数[持续更新]
- C#中获取路径
- GDM 中自定义一个会话(session)
- CSDN是个破地儿
- GUI,window manager,desktop,和interface间的联系
- 对 X, GUI 更详细的解释
- 更新多行函数
- 奥运纪念金币第一组
- 奥运纪念金币第二组
- ORACLE学习笔记(一)
- C#中关于集合的一个小例子
- 自已整理的C#常用指令
- 给CSDN博客侧栏添加搜索功能
- treeview_AfterSelect问题 c# c++
- 新标日语初级第28课应用课文默写