In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to solve the problem that GridView_RowUpdating cannot get a new value". In daily operation, I believe many people have doubts about how to solve the problem that GridView_RowUpdating cannot get a new value. I have consulted all kinds of information and sorted out simple and easy operation methods. I hope to help you answer the question of "how to solve the problem that GridView_RowUpdating cannot get a new value"! Next, please follow the small series to learn together!
The copy code is as follows:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
sqlcon = new SqlConnection(strCon);
sqlcon.Open();
string bianhao = Convert.ToString(this.GridView1.DataKeys[e.RowIndex].Value);
string beizhu = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString();
string sqlstr = "SQL statement '";
sqlcom = new SqlCommand(sqlstr, sqlcon);
sqlcom.ExecuteNonQuery();
sqlcon.Close();
GridView1.EditIndex = -1;
bind();
}
The column value is the original one, not the updated one. The reason is that Page_Load loads data, which will be refreshed automatically after each update. Therefore, it is necessary to determine whether the page is returned and loaded again in Page_Load, as follows
The copy code is as follows:
protected void Page_Load(object sender, EventArgs e)
{
if (! Page.IsPostBack)
{
bind();
}
}
At this point, the study of "how to solve the problem that GridView_RowUpdating cannot get a new value" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.