[英]First update ignored when updating modle asynchronously in AngularJS ng-click handler
[英]gridview not updating when id click on update
单击更新时,它不会更新并返回其先前的值,但是删除选项可以正常工作
Id = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblDealerId")).Text;
Name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDealer_Name")).Text;
Address = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDealer_Address")).Text;
City = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtCity")).Text;
Pincode = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDealer_Pincode")).Text;
string cs = ConfigurationManager.ConnectionStrings["dbcs"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("sp_update_dealer", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@dealer_id", SqlDbType.NVarChar).Value = Id;
cmd.Parameters.Add("@dealer_name", SqlDbType.NVarChar).Value = Name;
cmd.Parameters.Add("@dealer_address", SqlDbType.NVarChar).Value = Address;
cmd.Parameters.Add("@dealer_city", SqlDbType.NVarChar).Value = City;
cmd.Parameters.Add("@dealer_pincode", SqlDbType.NVarChar).Value = Pincode;
//GridView1.EditIndex = -1;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
您的标签lblDealerId
也应放在EditTemplate
:
<EditItemTemplate>
<asp:Label ID="lblDealerId" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
//.. some other TexBoxes
</EditItemTemplate>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.