| // Set up the scroll position |
| var currentIndex = <%= this.CurrentIndex %>; |
| var isFirstLoad = true; |
| function OnItemShown(sender, arg) { |
| if (isFirstLoad == true) { // First loading |
| isFirstLoad = false; |
| sender.set_scrollDuration(0); |
| // now scroll until currentIndex is reached |
| for (var i = 0; i < currentIndex; i++) |
| { |
| sender.showNext(Telerik.Web.UI.RotatorScrollDirection.Up); |
| } |
| sender.set_scrollDuration(500); |
| } |
| } |
I have a checkbox in my RadGrid. If that checkbox is checked, then I change the background color for that row in RadGrid1_ItemDataBound:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
'Change the color of inactive rows
If TypeOf e.Item Is GridDataItem Then
Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
Dim chk_Status As CheckBox = DirectCast(item.FindControl("chk_Status"), CheckBox)
If chk_Status.Checked = False Then
e.Item.BackColor = Drawing.Color.RoyalBlue
End If
End If
End Sub
But if I click on any header column to sort that column, the cells in the alternating rows that are highlighted are not highlighted in the background color I specified.
| <cc1:MyComboBox ID="dl2" TabIndex="7" BackColor="White" Width="72px" runat="server" |
| Font-Size="12px" Font-Names="Arial" CssClass="txtBox"> |
| <Items> |
| <telerik:RadComboBoxItem Selected="True" Value="N/A"></telerik:RadComboBoxItem> |
| <telerik:RadComboBoxItem Value="Male" Text="Male"></telerik:RadComboBoxItem> |
| <telerik:RadComboBoxItem Value="Female" Text="Female"></telerik:RadComboBoxItem> |
| </Items> |
| </cc1:MyComboBox> |
| <cc1:MyComboBox ID="dl1" TabIndex="1" BackColor="White" Width="160px" runat="server" |
| Font-Size="12px" Font-Names="Arial"> |
| </cc1:MyComboBox> |
| public class MyComboBoxItem : RadComboBoxItem |
| { |
| public MyComboBoxItem() |
| { |
| } |
| } |
| public class MyComboBoxItemCollection : RadComboBoxItemCollection |
| { |
| public MyComboBoxItemCollection():base(null) |
| { |
| } |
| public MyComboBoxItemCollection(Control parent):base(parent) |
| { |
| } |
| } |
| <cc1:MyComboBox ID="dl2" TabIndex="7" BackColor="White" Width="72px" runat="server" |
| Font-Size="12px" Font-Names="Arial" CssClass="txtBox"> |
| <Items> |
| <cc1:MyComboBoxItem Selected="True" Value="N/A"></cc1:MyComboBoxItem> |
| <cc1:MyComboBoxItem Value="Male" Text="Male"></cc1:MyComboBoxItem> |
| <cc1:MyComboBoxItem Value="Female" Text="Female"></cc1:MyComboBoxItem> |
| </Items> |
| </cc1:MyComboBox> |
I'm sure I'm missing something simple here...
I have menu where the root nodes are loaded in the code behind and the child menu items are loaded on demand via a web service. I need to apply a different css style to child menu items of a specific root item. I thought I could do this on the OnClientItemPopulated event with the following code:
| function itemPopulated(sender, eventArgs) |
| { |
| var item = eventArgs.get_item(); |
| if (item && item.get_value() == "myValue") |
| { |
| for (var i=0; i < item.get_items().get_count(); i++) |
| { |
| item.get_items().getItem(i).set_cssClass("myCssClass"); |
| } |
| } |
| } |
However, I noticed that the style for the items, as the menu is expanding and when it is open, is the default style and that my applied style only takes effect as the menu is closing. What am I missing?
| <InsertItemTemplate> |
| <table style="width: 100%;"> |
| <tr> |
| <td class="MasterFilesLableCells"><asp:Label ID="ItemCodeLabel" runat="server" meta:resourcekey="ItemCodeLabel" /></td> |
| <td class="MasterFilesDataCells"> |
| <telerik:RadComboBox ID="ItemCodeRadComboBox" Runat="server" |
| DataSourceID="objDsItemNames" |
| DataTextField="ItemCode" |
| DataValueField="ItemId" |
| AppendDataBoundItems="True" |
| OnSelectedIndexChanged="ItemCodeRadComboBox_SelectedIndexChanged"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" Selected="True" text="Select An Item" Value="-1" /> |
| </Items> |
| </telerik:RadComboBox> |
| </td> |
| </tr> |
| <tr> |
| <td class="MasterFilesLableCells"><asp:Label ID="PrintroomNamesLabel" runat="server" meta:resourcekey="PrintroomNamesLabel" /></td> |
| <td class="MasterFilesDataCells"><uc2:PrintroomNames ID="PrintroomNames1" runat="server" SelectedValue='<%# Bind("PrintRoomName") %>' /></td> |
| </tr> |
| <tr> |
| <td class="MasterFilesLableCells"><asp:Label ID="ItemCostLabel" runat="server" meta:resourcekey="ItemCostLabel" /></td> |
| <td class="MasterFilesDataCells"> |
| <asp:Label ID="LabelItemCost" runat="server" Text='<%# Bind("ItemCost") %>' /> |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2"> |
| <asp:RadioButton ID="RadioButtonAdjustUp" runat="server" Text="Adjust Up" GroupName="AdjustDirection" Checked='<%# Bind("AdjustDirectionUp") %>' /> |
| <asp:RadioButton ID="RadioButtonAdjustDown" runat="server" Text="Adjust Down" GroupName="AdjustDirection" Checked='<%# Bind("AdjustDirectionDown") %>' /> |
| </td> |
| </tr> |
| <tr> |
| <td class="MasterFilesLableCells"><asp:Label ID="AdjustmentAmountLabel" runat="server" meta:resourcekey="AdjustmentAmountLabel" /></td> |
| <td><telerik:RadTextBox ID="AdjustmentAmountTextBox" runat="server" Text='<%# Bind("AdjustmentAmount") %>' Skin="Windows7" /></td> |
| </tr> |
| <tr> |
| <td class="MasterFilesLableCells"><asp:Label ID="AdjustmentDateLabel" runat="server" meta:resourcekey="AdjustmentDateLabel" /></td> |
| <td class="MasterFilesDataCells"> |
| <telerik:RadDatePicker ID="AdjustmentDateLabelRadDatePicker" runat="server" SelectedDate='<%# Bind("AdjustmentDate") %>' > |
| </telerik:RadDatePicker> |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2"><asp:Label ID="AdjustmentReasonLabel" runat="server" meta:resourcekey="AdjustmentReasonLabel" /></td> |
| </tr> |
| <tr> |
| <td colspan="2"> |
| <telerik:RadTextBox ID="AdjustmentReasonTextBox" runat="server" Text='<%# Bind("AdjustmentReason") %>' Rows="5" Width="450" Height="50" TextMode="MultiLine" /> |
| </td> |
| </tr> |
| <tr> |
| <td><asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" /></td> |
| <td align="right"><asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /></td> |
| </tr> |
| </table> |
| </InsertItemTemplate> |
| Inherits System.Web.UI.Page |
| Dim ItemCodeRadComboBox As Telerik.Web.UI.RadComboBox = CType(FindControl("ItemCodeRadComboBox"), Telerik.Web.UI.RadComboBox) |
| Dim LabelItemCost As Label = CType(FindControl("LabelItemCost"), Label) |
| Protected Sub ItemCodeRadComboBox_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) |
| Dim ItemsAPI As New SBIS.FMSuite.Items.ItemMasterBLL |
| Dim Items As SBIS.FMSuite.Items.ItemMasterDAL.ItemsDataTable = ItemsAPI.GetItemsByItemID(ItemCodeRadComboBox.SelectedValue) |
| Dim Item As SBIS.FMSuite.Items.ItemMasterDAL.ItemsRow = Items(0) |
| If Item.CostingMethod = "Last cost price" Then |
| LabelItemCost.Text = Item.LastCostPrice |
| Else |
| LabelItemCost.Text = Item.AverageCostPrice |
| End If |
| End Sub |