RadComboBox inside RadWindow

2 posts, 0 answers
  1. Mohamed Ramadan
    Mohamed Ramadan avatar
    6 posts
    Member since:
    Feb 2010

    Posted 25 Nov 2010 Link to this post

    Hello Sir,

    We use RadComboBox inside RadWindow as the following:

    <telerik:RadWindow ID="WinFirms" runat="server" Title="Select Firm" Width="500" Height="200" Behaviors="Move"  VisibleStatusbar="false"
        VisibleOnPageLoad="false" Modal="true" EnableShadow="true" DestroyOnClose="false" Skin="Sunset">
        <ContentTemplate>
        <div style="padding:10px;">
            <div style="float:left; width:10px;">
            Firm:
            </div>
            <div>
                <telerik:RadComboBox runat="server" ID="ddlFirm" Width="100%" MarkFirstMatch="True" CausesValidation="false" HighlightTemplatedItems="true">
                    <HeaderTemplate>
                            <table style="width:95%" cellspacing="0" cellpadding="0" class="MultiColumnComboBox">
                                <tr>
                                    <td style="width: 50px">DFSA No</td>
                                    <td style="width: 100px">Firm Name</td>
                                    <td style="width: 50px">Capacity</td>
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <table style="width:100%" cellspacing="0" cellpadding="0" class="MultiColumnComboBox">
                                <tr>
                                    <td style="width: 20%; color:Gray;"><%#DataBinder.Eval(Container.DataItem, "DfsaNo")%> </td>
                                    <td style="width: 70%"><%#DataBinder.Eval(Container.DataItem, "DName")%></td>
                                    <td style="width: 10%; color:Gray;"><%#DataBinder.Eval(Container.DataItem, "Capacity")%></td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </telerik:RadComboBox>
            </div>
            </div>
            <div style="text-align:center;">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Firm is required" Display="Dynamic" ControlToValidate="ddlFirm"></asp:RequiredFieldValidator>
                <asp:Button runat="server" id="WinOK" OnClientClick="SubmitFirmDialog();return false;" Text="OK" UseSubmitBehavior="False" ValidationGroup="SubmitWindow" CausesValidation="true"/>
                <asp:Button runat="server" id="WinCancel" OnClientClick="Hide();return false;" Text="Cancel" UseSubmitBehavior="False"  />
            </div>
        </ContentTemplate>
    </telerik:RadWindow>

    We Fill DDL as following

    Sub LoadFirmData()
            ddlFirm.DataSource = FirmDetails.GetAfAspRaFirmByVal()
            ddlFirm.DataBind()
    End Sub

    We set the values inside ItemDataBound even handler after binding it

    Protected Sub ddlFirm_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles ddlFirm.ItemDataBound
            e.Item.Text = e.Item.DataItem.DName
            e.Item.Value = e.Item.DataItem.PersonID & "%" & e.Item.DataItem.Capacity
            e.Item.Attributes.Add("FirmID", e.Item.DataItem.PersonID)
            e.Item.Attributes.Add("Capacity", e.Item.DataItem.Capacity)
            e.Item.Attributes.Add("DfsaNo", e.Item.DataItem.DfsaNo)
        End Sub

    First page Load the data loads successfully and displayed inside the ComboBox.

     

    When a callback happens the ComboBox loads all data as empty as the following HTML:

     

    <li class="rcbItem  rcbTemplate">

        <table cellspacing="0" cellpadding="0" class="MultiColumnComboBox" style="width: 100%;">

            <tbody><tr>

                <td style="width: 20%; color: Gray;">&nbsp;</td>

                <td style="width: 70%;"></td>

                <td style="width: 10%; color: Gray;"></td>

            </tr>

        </tbody></table>

    </li>

     

    At the same time when we assess the list items on client side we get the results of (value + attributes) correctly. But its not displayed in the dropdown.

     

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Nov 2010 Link to this post

    Hello Mohamed Ramadan,

    This can happen if the RadComboBox' DataBind method (in LoadFirmData) is not called on this callback you mentioned. Please make sure you always bind the ComboBox whenever you need its Items (and Templates) loaded.

    Best wishes,
    Simon
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top