本文介绍了这是我在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 + ; 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.ThanksHitesh VardeSr. Software EngineerI have sort it out..thanks......................................................................................................................................................................................... 这篇关于这是我在gridview的row_updating事件中编写的代码(name = grid)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-03 04:11