更新时间:2023-02-26 19:23:49
这种情况正在发生,因为您正在更新所有行...
This is happening because you are updating all the rows...
foreach ( GridView row in GridView1.Rows)
要仅更新已编辑的特定行,您必须存储一个引用或 Key 位于 ViewState
或 Session
或a HiddenField
或其他什么。您有一个 ID
列。因此,您可以将其存储为参考。
然后在按钮3单击事件中,读取键
并更新该特定的行。
To update only the particular row edited, you have to store one reference or Key
of that Row somewhere either on ViewState
or Session
or a HiddenField
or something. You have one ID
column. So, you can store that as a reference.
Then inside this Button 3 Click Event, read that Key
and update that particular Row.