【发布时间】:2011-05-13 09:42:13
【问题描述】:
我在我的项目中使用 RadListBox (asp.net with c# with vs2010)
我也在 itemTemplate 中使用一些链接按钮...
当我们悬停或选择列表框中的项目时,我想更改这些链接按钮的颜色! (客户端编程)
我的 RadListBox 是这样的:
<telerik:RadListBox ID="RadlbOfImageGroup" runat="server" DataKeyField="ID" DataSortField="Title"
DataSourceID="sdsImagesGroup" DataTextField="Title" DataValueField="ID" Skin="BlackByMe"
EnableEmbeddedSkins="False" EmptyMessage="No Records!">
<ButtonSettings TransferButtons="All" />
<HeaderTemplate> <div id="Header_RadlbOfImageGroup"><h5>Header Area</h5></div>
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="lbTitleOfIG" CssClass="lbTitleOfIGclass" runat="server" CausesValidation="False"><%# Eval("Title") %></asp:LinkButton>
<asp:Label ID="lblTitleOfIG" CssClass="lblTitleOfIGclass" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
<asp:LinkButton ID="lbEditOfIG" CssClass="lbEditOfIGclass" runat="server" CausesValidation="False"
CommandName="Edit">Edit</asp:LinkButton>
<asp:LinkButton ID="lbDeleteOfIG" CssClass="lbDeleteOfIGclass" runat="server" CausesValidation="False"
CommandName="Delete">Delete</asp:LinkButton>
</ItemTemplate>
</telerik:RadListBox>
我想在悬停和选择项目期间更改 lbTitleOfIG 的颜色!
我该如何做这份工作?
感谢关注
第一个答案解决的上层问题 - 谢谢兄弟...
=================================
但在进行如下更改后我遇到了一个新问题:
<telerik:RadAjaxPanel ID="RadAjaxPanelInrpvImageGroup" runat="server" Height="290px" Width="400px">
<telerik:RadListBox ID="RadlbOfImageGroup" runat="server" DataKeyField="ID" DataSortField="Title"
DataSourceID="sdsImagesGroup" DataTextField="Title" DataValueField="ID" Skin="BlackByMe"
EnableEmbeddedSkins="False" Width="260px" Height="365px"
EmptyMessage="no records!" AutoPostBack="True"
onselectedindexchanged="RadlbOfImageGroup_SelectedIndexChanged">
<ItemTemplate>
<table style="width: 100%;">
<tr style="width: 100%;">
<td style="width: 64%;">
<asp:Label ID="lblTitleOfIG" runat="server" CssClass="lbl_ListBox_IG_Title" Text='<%# Eval("Title") %>'></asp:Label>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbEditIG" runat="server" CausesValidation="False" CommandName="Edit"
CssClass="lb_ListBox_IG" OnClick="lbEditIG_Click">Edit</asp:LinkButton>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbDeleteIG" runat="server" CausesValidation="False" CommandName="Delete"
CssClass="lb_ListBox_IG" OnClick="lbDeleteIG_Click">Delete</asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadListBox>
</telerik:RadListBox>
</telerik:RadAjaxPanel>
change#1:如你所见,我将 RadListBox 放入了 RadAjaxPanel(它的作用类似于 UpdatePanel)...
change#2:使用 AutoPostBack="True" 添加 SelectedIndexChanged 事件(服务器端)...
我在 SelectedIndexChanged 事件中有一些代码在 ajax 模式下运行良好......
但是我的新问题是,当我通过单击另一个项目(或单击其中一个链接按钮,如 lbEditIG 或 lbDeleteIG)更改选定项目并因此发生回调时,我失去了我们设置的 lbTitleOfIG 颜色下面的CSS:
.rlbActive .rlbTemplate span.lbl_ListBox_IG_Title
{
color:#9EDA29 !important;
}
.rlbTemplate:hover span.lbl_ListBox_IG_Title
{
color:#9EDA29 !important;
}
但所选区域仍然突出显示...
我知道这个颜色的东西不是那么重要,但是几个月前我遇到了一个关于 RadComboBox 的类似问题(在 selectedIndexChanged 回调后失去焦点)
非常感谢您给我一个解决方案,所以我可以将它用于其他目的......
感谢您阅读本文并将您宝贵的时间用于此主题
【问题讨论】:
标签: asp.net telerik hover client-side radlistbox