I have the following code for Gridview:
<SelectedRowStyle CssClass="SelectedRowStyle" />
where I change the selected row to yellow color.
And then on a button click I want to remove the css class. I tried to handle that in code by following:
Gridview1.SelectedRow.CssClass=
Gridview1.SelectedRow.CssClass.Replace("SelectedRowStyle","")
Gridview1.SelectedRowStyle.CssClass=
Gridview1.SelectedRowStyle.CssClass.Replace("SelectedRowStyle","");
Gridview1.SelectedRow.Attributes.Remove("SelectedRowStyle");
But nothing works. Where am I going wrong ?
只需将空字符串分配给CssClass属性,并记住您将需要重新绑定网格视图以获取更改
Gridview1.SelectedRow.CssClass = "";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.