![](/img/trans.png)
[英]GridView SelectedRowStyle not applied to row selected in code
[英]Is to set SelectedRowStyle attribute a bad idea to change the background color of a selected row?
我要實現的是更改gridview中所選行的背景顏色。
我有命令字段。
然后設置SelectedRowStyle =“ highlight”類。
但是當我選擇該行時,沒有任何變化:(
我知道我可以在后面的代碼上對Gridview事件進行一些更改。 但是我應該僅通過簡單的標記更改就可以實現這一目標,而不必編寫代碼來設置每個單元格的CssStyle。
拜托,你能看到我在做什么錯嗎?
<asp:GridView ID="gvResults" runat="server" OnRowCommand="GridViewResults_RowCommand"
SelectedRowStyle="highlight">
<Columns>
<!-- Some bound fields here -->
<asp:CommandField SelectText="Select >>" ShowSelectButton="true"/>
</Columns>
將SelectedRowStyle
更改為SelectedRowStyle-CssClass
屬性
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.