本文介绍了如何在ASP.Net中编辑gridview中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,

我有gridview,它包含文本框,我将数据绑定到该文本框现在我想要更改文本框数据并传输到DB,我会在GridViewRowCommand事件,但是有一些问题,所以即时尝试在GriViewRowUpdating事件中,但即使是在编辑按钮点击事件中也不会激活...请帮帮我????

//这个我的代码



public void GridView1_RowUpdating(object sender,GridViewUpdateEventArgs e)

{



string CheckpointName =((TextBox)GridView1.Rows [e.RowIndex]

.FindControl(somevalue))。Text;

string Query =UPDATE check_points SET CHECKPOINT_NAME ='+ CheckpointName +'WHERE ROOT_ID ='+ TextBox1.Text +';

if(access.insert_delete_update(Query))

{

ScriptManager.RegisterStartupScript(this,this.GetType(),

" Message"," alert(Error);",true);

}

GridView1.EditIndex = -1;

GridView1.DataBind();



}

Dear friends,
I have gridview and its contain textboxes and Im bind data to that textboxes now im want to make changes that text box data and transfer to DB,I'l do that inside the GridViewRowCommand event,but there are some issues,so im try that inside the GriViewRowUpdating event but that even is does not fire in edit button click event...Please help me????
//this my code

public void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

string CheckpointName = ((TextBox)GridView1.Rows[e.RowIndex]
.FindControl(somevalue)).Text;
string Query = "UPDATE check_points SET CHECKPOINT_NAME = '" + CheckpointName + "' WHERE ROOT_ID='" + TextBox1.Text + "'";
if (access.insert_delete_update(Query))
{
ScriptManager.RegisterStartupScript(this, this.GetType(),
"Message", "alert(Error);", true);
}
GridView1.EditIndex = -1;
GridView1.DataBind();

}

推荐答案



这篇关于如何在ASP.Net中编辑gridview中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 22:13