This is a migrated thread and some comments may be shown as answers.

RadComboBox inside RadWindow

1 Answer 185 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mohamed Ramadan
Top achievements
Rank 1
Mohamed Ramadan asked on 25 Nov 2010, 05:07 PM
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.

 

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 29 Nov 2010, 04:26 PM
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.
Tags
ComboBox
Asked by
Mohamed Ramadan
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or