这是我在gridview的row_updating事件中编写的代码(name = grid) [英] This is my code written in row_updating event of gridview(name=grid)
本文介绍了这是我在gridview的row_updating事件中编写的代码(name = grid)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void grid_RowUpdating(对象发件人,GridViewUpdateEventArgs e)
{
try
{
TextBox txtEditname =( TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditname);
RegistrationBLL.name = txtEditname.Text.Trim()。ToString();
TextBox txtEditaddress =(TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditaddress跨度>);
RegistrationBLL.address = txtEditaddress.Text.Trim()。ToString();
TextBox txtEditemail =(TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditemail跨度>);
RegistrationBLL.emailid = txtEditemail.Text.Trim()。ToString();
TextBox txtEditcountry =(TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditcountry跨度>);
RegistrationBLL.country1 = txtEditcountry.Text.Trim()。ToString();
TextBox txtEditstate =(TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditstate跨度>);
RegistrationBLL.state1 = txtEditstate.Text.Trim()。ToString();
TextBox txtEditcity =(TextBox)grid.Rows [e.RowIndex] .FindControl( txtEditcity跨度>);
RegistrationBLL.city = txtEditcity.Text.Trim()。ToString();
int id = Convert.ToInt32(grid.DataKeys [e.RowIndex] .Value.ToString());
int val = Convert.ToInt32(obj_bll.INS_Registration1( ref Errmsg, 2 ,id));
if (val!= 0 )
{
lblmsg.Text = 您的活动详细信息已成功更新。;
lblmsg.ForeColor = System.Drawing.Color.Green;
grid.EditIndex = -1;
bindgrid();
}
}
catch (例外情况)
{
lblmsg.Text = + ex.Message + < span class =code-string> ;
lblmsg.ForeColor = System.Drawing.Color.Red;
}
}
已添加 pre
标签。
[/编辑]
解决方案
能告诉我们你究竟是什么寻找?
关于问题,期望结果或类似内容的一些细节。
谢谢
Hitesh Varde
高级软件工程师
我已经把它解决了......谢谢........... .................................................. .................................................. .................................................. ........................
protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
TextBox txtEditname = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditname");
RegistrationBLL.name = txtEditname.Text.Trim().ToString();
TextBox txtEditaddress = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditaddress");
RegistrationBLL.address = txtEditaddress.Text.Trim().ToString();
TextBox txtEditemail = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditemail");
RegistrationBLL.emailid = txtEditemail.Text.Trim().ToString();
TextBox txtEditcountry = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditcountry");
RegistrationBLL.country1 = txtEditcountry.Text.Trim().ToString();
TextBox txtEditstate = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditstate");
RegistrationBLL.state1 = txtEditstate.Text.Trim().ToString();
TextBox txtEditcity = (TextBox)grid.Rows[e.RowIndex].FindControl("txtEditcity");
RegistrationBLL.city = txtEditcity.Text.Trim().ToString();
int id = Convert.ToInt32(grid.DataKeys[e.RowIndex].Value.ToString());
int val = Convert.ToInt32(obj_bll.INS_Registration1(ref Errmsg, 2, id));
if (val != 0)
{
lblmsg.Text = "Your Event Details Updated Sucessfully.";
lblmsg.ForeColor = System.Drawing.Color.Green;
grid.EditIndex = -1;
bindgrid();
}
}
catch (Exception ex)
{
lblmsg.Text = "" + ex.Message + "";
lblmsg.ForeColor = System.Drawing.Color.Red;
}
}
[Edit member="Tadit"]
Added pre
tags.
[/Edit]
解决方案
Can you please tell us what exactly are you looking for?
Some detail about issue, desired result or something like that.
Thanks
Hitesh Varde
Sr. Software Engineer
I have sort it out..thanks.........................................................................................................................................................................................
这篇关于这是我在gridview的row_updating事件中编写的代码(name = grid)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文