对GradView的增删改
来源:百度文库 编辑:神马文学网 时间:2024/04/30 04:39:13
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Models;
using DAL;
using System.Data.SqlClient;
public partial class Text_Proc_edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack){
Baind();
} }
///
/// 让我Grview处于编辑状态
///
///
///
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
Baind(); }
///
/// 更新
///
///
///
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
LoginLog lgin=new LoginLog();
lgin.LoginId =Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
lgin.UserId = Convert.ToString(((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text);
lgin.IfSuccess =Convert.ToInt32(((DropDownList)GridView1.Rows[e.RowIndex].Cells[3].FindControl("DropDownList1")).SelectedValue);
lgin.LoginDesc = Convert.ToString(((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text);
int num = LoginLogService.Update(lgin);
if (num > 0)
{
Response.Write("");
}
GridView1.EditIndex = -1;
}
///
/// 取消编辑
///
///
///
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
Baind();
} private void Baind()
{
GridView1.DataSource = LoginLogService.GetLists();
GridView1.DataBind();
}
///
/// 删除
///
///
///
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int logind =Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
int num = LoginLogService.DeleteByloginId(logind);
if(num>0){
Response.Write("");
}
}
}
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Models;
using DAL;
using System.Data.SqlClient;
public partial class Text_Proc_edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack){
Baind();
} }
///
/// 让我Grview处于编辑状态
///
///
///
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
Baind(); }
///
/// 更新
///
///
///
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
LoginLog lgin=new LoginLog();
lgin.LoginId =Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
lgin.UserId = Convert.ToString(((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text);
lgin.IfSuccess =Convert.ToInt32(((DropDownList)GridView1.Rows[e.RowIndex].Cells[3].FindControl("DropDownList1")).SelectedValue);
lgin.LoginDesc = Convert.ToString(((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text);
int num = LoginLogService.Update(lgin);
if (num > 0)
{
Response.Write("");
}
GridView1.EditIndex = -1;
}
///
/// 取消编辑
///
///
///
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
Baind();
} private void Baind()
{
GridView1.DataSource = LoginLogService.GetLists();
GridView1.DataBind();
}
///
/// 删除
///
///
///
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int logind =Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
int num = LoginLogService.DeleteByloginId(logind);
if(num>0){
Response.Write("");
}
}
}
对GradView的增删改
一个使用ibatis对数据库增删改查的例子
一个使用ibatis对数据库增删改查的例子
DOM4J对XML文档的读写增删改等
乱弹中学新课文的增删
不停集群的情况下增删节点
中国的医改和教改,应该对教会开门
中国的医改和教改,应该对教会开门
风险投资中对凯利公式的改
中国的医改和教改,应该对教会开门
命理学家易隐燕对改运的看法
命理学家易隐燕对改运的看法
如何提高教师对新课改的适应性
《增删卜易卦例初探》序言 - 朱辰彬的日志 - 网易博客
关于对浈江区曲仁矿务局水改工程第二标段格顶矿区水改工程进行验收的请示
国华:辛酸的自助透析,寄托对医改的希望(新京报 2009-3-28)
汇改和升值对理财生活的影响简析
命理学家易隐燕对改运的看法 [和讯博客]
杭州车改随意改变是对政府信誉的调侃
【原创】对衡量公务车改标准创新 - 少林小子的日志 - 网易博客
奥巴马医改及对中国的启示-中国选举与治理网
向松祚:对央行的汇改决定深表失望和愤慨 - 财识网
汇改对当前行情的影响有限-皮海洲-搜狐博客
汇改和升值对理财生活的影响简析