I am trying to style individual items in a RadComboBox in EditFormSettings
1 Answer 7 Views
Colin
Top achievements
Rank 1
Colin asked on 12 Jul 2021, 09:42 PM

Here is my code

 

Markup

<EditFormSettings EditFormType="Template">
   <FormTemplate>
      <table id="tblEmployeeDetails" style="width:100%">
         <tr class="EditFormHeader">
            <td colspan="2">
               <b>EMPLOYEE DETAILS</b>
            </td>
         </tr>
         <tr>
            <td class="labelHeader">Manager Full Name:</td>
            <td>
               <telerik:RadComboBox RenderMode="Lightweight" ID="rcbManageFullNameEdit" DataSourceID="SQL_Employees" 
                  DataTextField="FULLNAME" DataValueField="IDNUM" Width="200px" AppendDataBoundItems="true" 
                  SelectedValue='<%#Eval("MANAGER_IDNUM")%>' runat="server" OnItemCreated="rcbManageFullNameEdit_itemCreated">
                  <Items>
                     <telerik:RadComboBoxItem Text="-- CHOOSE --" Value ="0" />
                  </Items>
               </telerik:RadComboBox>
    </td>
         </tr>
      </table>   
   </FormTemplate>
</EditFormSettings>

VB.Net Code

Protected Sub rcbManageFullNameEdit_itemCreated(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)
        Dim item As RadComboBoxItem = e.Item
        Dim x = item.Value

        Dim dt1 As DataTable = New DataTable
        dt1 = DAL.spHR_GetManagerList()

        Dim dv1 As DataView = dt1.DefaultView

        For Each row1 As DataRowView In dv1
            If item.Value = row1!IDNUM Then
                item.CssClass = "manager"
            End If
        Next
End Sub

 

My item.Value is always empty.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 15 Jul 2021, 04:47 PM

Hi Colin,

The ItemCreated event fires for the ComboItem that was created but it has no data bound to it at that point. That is why the value is empty. 

If you want to access the values, use the ItemDataBound event.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Asked by
Colin
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or