4 Answers, 1 is accepted
You can try the following code snippet.
C#:
protected
void
RadRotator1_ItemClick(
object
sender, RadRotatorEventArgs e)
{
RadRotatorItem item = (RadRotatorItem)e.Item;
item.CssClass =
"cssitem"
;
}
CSS:
<style type=
"text/css"
>
.cssitem
{
color
:Red;
}
</style>
Thanks,
Princy.
Thanks for the reply, even after trying your suggestion i am not able to set the border color for selected rotator item, can you please help on this.
Thanks,
Mahesh
Basically, you can utilize CSS in order to configure the border of the RadRotator control and its items. The following steps will help you achieve the desired effect:
- The internal CSS class rrClipRegion can be overridden in order to set a new color for the rotator control's border.
- The color of the item's borders can be specified via some additional CSS classes and the property CssClass of every RadRotator's item.
The approach, suggested above, is demonstrated in the attached sample page. You can use it as a reference for incorporating the solution into your actual project.
Regards,
Slav
the Telerik team
hi,
i have some task which is similar to this.
i binded data to radrotator from code behind. now i have to highlight the item when i mouseovere. it should happen in client side only.
i tried by applying css to item OnClientMouseOver event. but it is not working..
here is my code
javascript:
function employeeMouseOver(sender, eventArgs) {
eventArgs.get_item()._cssClass = "rrHover";
}
css:
.rrHover {
background-color: pink !important;
}
aspx:
<telerik:RadRotator RenderMode="Lightweight" ID="thumbRotator" runat="server" Skin="Silk" RotatorType="ButtonsOver" Width="1280px" BackColor="White"
Height="104px" ItemHeight="95" ItemWidth="95" FrameDuration="1" ScrollDirection="Left,Right" AutoPostBack="false"
OnClientItemClicked="ChartItemClicked" OnClientMouseOver="employeeMouseOver">
<ItemTemplate>
<telerik:RadLabel runat="server" ID="lbl_imageInfo"></telerik:RadLabel>
</ItemTemplate>
<ControlButtons LeftButtonID="img_left" RightButtonID="img_right"></ControlButtons>
</telerik:RadRotator>
aspx.cs
for (int i = 0; i < rotatorData.Rows.Count; i++)
{
RadRotatorItem item1 = new RadRotatorItem();
HtmlGenericControl div = new HtmlGenericControl("div");
item1.Controls.Add(div);
string imgname = rotatorData.Rows[i][1].ToString().Trim();
HtmlGenericControl img = new HtmlGenericControl("img");
div.Controls.Add(img);
img.Attributes.Add("src", "Images/" + imgname + ".png");
item1.ToolTip = imgname;
item1.Attributes.Add("Value", imgname);
thumbRotator.Items.Add(item1);
RadRotator RW_radrotator = (RadRotator)FindControl("thumbRotator");
RadLabel lbl = (RadLabel)item1.FindControl("lbl_imageInfo");
lbl.Text = imgname;
}