Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 rowcommand 上更新 gridview 的数据源。我有一个 TemplateField 作为按钮,并且在 Datasource 中有一个 Bool 变量 IsClicked 来记录按钮是否曾经被点击过。如果单击按钮并将更新的数据源分配给网格,我需要将 IsClicked 值更新为 true。
您可以尝试使用此代码
void GridView_RowCommand(Object sender, GridViewCommandEventArgs e) { //You can try with Command Name. if(e.CommandName=="Update") { ..... } //You can also try with sender parameter var control = (Button)sender; if(control.Id = "YourId") { ..... } }