asp.net 编辑gridview的小例子
更新时间:2013年04月26日 00:34:52 作者:
gridview的编辑方法的小例子,一段代码,供大家学习参考
编辑gridview例子,完整代码如下。
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BingGrid();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BingGrid();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
GridViewRow row = GridView1.Rows[e.RowIndex];
string TXB_FORUMNAME = ((TextBox)row.FindControl("TXB_FORUMNAME")).Text.Trim().ToString();
int TXB_ROOTFORUMID = Convert.ToInt16(((TextBox)row.FindControl("TXB_ROOTFORUMID")).Text.Trim());
int TXB_ISDISPLAY = Convert.ToInt16(((TextBox)row.FindControl("TXB_ISDISPLAY")).Text.Trim());
string TXB_MASTER = ((TextBox)row.FindControl("TXB_MASTER")).Text.ToString();
int TXB_ISLOCK = Convert.ToInt16(((TextBox)row.FindControl("TXB_ISLOCK")).Text.Trim());
int LB_FORUMID=Convert.ToInt16(((Label)row.FindControl("Label6")).Text);
ForumBLL.Forum_Update_Name(TXB_FORUMNAME, TXB_ISDISPLAY, TXB_ROOTFORUMID, TXB_MASTER, TXB_ISLOCK, LB_FORUMID);
}
catch (Exception ex)
{
Response.Write(ex);
}
GridView1.EditIndex = -1;
BingGrid();
}
GridView直接编辑,删除经典例子下载
复制代码 代码如下:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BingGrid();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BingGrid();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
GridViewRow row = GridView1.Rows[e.RowIndex];
string TXB_FORUMNAME = ((TextBox)row.FindControl("TXB_FORUMNAME")).Text.Trim().ToString();
int TXB_ROOTFORUMID = Convert.ToInt16(((TextBox)row.FindControl("TXB_ROOTFORUMID")).Text.Trim());
int TXB_ISDISPLAY = Convert.ToInt16(((TextBox)row.FindControl("TXB_ISDISPLAY")).Text.Trim());
string TXB_MASTER = ((TextBox)row.FindControl("TXB_MASTER")).Text.ToString();
int TXB_ISLOCK = Convert.ToInt16(((TextBox)row.FindControl("TXB_ISLOCK")).Text.Trim());
int LB_FORUMID=Convert.ToInt16(((Label)row.FindControl("Label6")).Text);
ForumBLL.Forum_Update_Name(TXB_FORUMNAME, TXB_ISDISPLAY, TXB_ROOTFORUMID, TXB_MASTER, TXB_ISLOCK, LB_FORUMID);
}
catch (Exception ex)
{
Response.Write(ex);
}
GridView1.EditIndex = -1;
BingGrid();
}
GridView直接编辑,删除经典例子下载
您可能感兴趣的文章:
- asp.net下gridview 批量删除的实现方法
- Asp.Net+XML操作基类(修改,删除,新增,创建)
- asp.net GridView 删除时弹出确认对话框(包括内容提示)
- asp.net中gridview的查询、分页、编辑更新、删除的实例代码
- Asp.net的GridView控件实现单元格可编辑方便用户使用
- ASP.NET MVC4入门教程(六):验证编辑方法和编辑视图
- 在ASP.NET 2.0中操作数据之十六:概述插入、更新和删除数据
- 在ASP.NET 2.0中操作数据之十七:研究插入、更新和删除的关联事件
- 在ASP.NET 2.0中操作数据之十九:给编辑和新增界面增加验证控件
- 在ASP.NET 2.0中操作数据之二十二:为删除数据添加客户端确认
- 在ASP.NET 2.0中操作数据之三十六:在DataList里编辑和删除数据概述
相关文章
详解.Net Core 权限验证与授权(AuthorizeFilter、ActionFilterAttribute)
这篇文章主要介绍了.Net Core 权限验证与授权(AuthorizeFilter、ActionFilterAttribute),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2019-04-04
将FreeTextBox做成控件添加到工具箱中的具体操作方法
以下是对将FreeTextBox做成控件添加到工具箱中的具体操作方法进行了详细的介绍,需要的朋友可以过来参考下2013-09-09
XmlReader 读取器读取内存流 MemoryStream 的注意事项
XmlReader 读取器读取内存流 MemoryStream 的注意事项...2007-04-04
运行asp.net时出现 http错误404-文件或目录未找到
问题描述: http错误404-文件或目录未找到的解决方法2009-03-03
ASP.NET GridView控件在列上格式化时间及DataFormatString使用
在GridView绑定日期格式的时候,数据库中的日期为2008-07-04,而GridView显示的是2007-07-04 000000,多了后面一截很不美观,想把它去掉不知道有什么好的方法,感兴趣的朋友可以了解本文,或许对你有所帮助2013-01-01


最新评论