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

LoadOnDemand doesn't work when you do binding in code

2 Answers 89 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
nightvision miami
Top achievements
Rank 1
nightvision miami asked on 24 Feb 2011, 03:23 PM
I have two radcomboboxes. When radcombobox VendorType SelectedIndex fires, radcombobox Vendor is then populated in code by the value chosen in VendorType . Radcombobox Vendor loads fine in code until I add the properties for MarkFirstMatch, EnableLoadOnDemand, and EnableTextSelection to radcombobox Vendor .  If I add these properties to the aspx page, then the radcombobox Vendor does not get loaded with the correct values on the selectedindexchange of radcombobox VendorType. If I do it in code after the radcombobox Vendor has done the binding or during the binding, radcombobox Vendor still does not get loaded with the correct values.

ASP.NET
<tr>
   <td>
       <asp:Label ID="Label25" runat="server" Text="Vendor Type: "></asp:Label>
   </td>
   <td>
       <telerik:RadComboBox ID="ddlVendorTypes" runat="server" SelectedValue='<%# Bind("RoleTypeCode") %>'
         DataSourceID="SqlDataSourceVendorTypes" DataTextField="Name" DataValueField="RoleTypeCode"
         AutoPostBack="true"  TabIndex="6" MarkFirstMatch="true" EnableLoadOnDemand="true"
         EnableTextSelection="true" onselectedindexchanged="ddlVendorTypes_SelectedIndexChanged">
      </telerik:RadComboBox>
   </td>
</tr>
<tr>
   <td>
      <asp:Label ID="Label6" runat="server" Text="Vendor: "></asp:Label>
   </td>
   <td>
      <telerik:RadComboBox ID="ddlVendors" runat="server" TabIndex="8">
     </telerik:RadComboBox>
   </td>
 </tr>

Binding Code
protected void ddlVendorTypes_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
    GridEditableItem editedItem = (o as RadComboBox).NamingContainer as GridEditableItem;
    RadComboBox ddlVendors = editedItem.FindControl("ddlVendors") as RadComboBox;
    RadComboBox ddlVendorTypes = editedItem.FindControl("ddlVendorTypes") as RadComboBox;
    VendorBinding(ddlVendors, ddlVendorTypes.SelectedValue);
}
private void VendorBinding(RadComboBox ddlVendors, string VendorType)
{
    if (SqlDataSourceVendors.SelectParameters.Count > 0)
        SqlDataSourceVendors.SelectParameters.RemoveAt(0);
    SqlDataSourceVendors.SelectParameters.Add("RoleTypeCode", VendorType);
    ddlVendors.DataSource = SqlDataSourceVendors;
    ddlVendors.DataTextField = "Name";
    ddlVendors.DataValueField = "PartyRoleID";
    ddlVendors.DataBind();
}


2 Answers, 1 is accepted

Sort by
0
Roger
Top achievements
Rank 1
answered on 28 Feb 2011, 05:41 PM

I'm seeing the same type of issues, combo isn't bound.

Also in addition if the combo is in a editform, popup, it get's hung in a continuous loop trying to bind the combo. 
This was not an issue prior to my recent upgrade to 2010.3.1317.35, on this one particular application, however on another app that uses the same type code, I'm not seeing any issues


<telerik:RadComboBox ID="ddlYear" DropDownWidth="100px" Width="100px" Height="100px"
                    runat="server" EnableAutomaticLoadOnDemand="false" EnableLoadOnDemand="true"
                    MarkFirstMatch="true" HighlightTemplatedItems="false" AutoPostBack="true" ExpandAnimation-Duration="0"
                    CollapseAnimation-Duration="0" ExpandDelay="0" EnableTextSelection="false">
                </telerik:RadComboBox>
  
  
Private Sub ddlYear_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlYear.ItemsRequested
  
        'We'll get a unique list of Years from PriceList table
        Dim dt As New DataTable
        Try
            dt = Me.objDataAccess_PriceList.GetPriceList_DistinctYear
        Catch ex As Exception
            Me.SystemMessage("Error", "Data Retrieve Failed!", ex.Message)
            Exit Sub
        End Try
  
        Me.ddlYear.DataSource = dt
        Me.ddlYear.DataTextField = "pl_Year"
        Me.ddlYear.DataValueField = "pl_Year"
        Me.ddlYear.DataBind()
    End Sub
0
Roger
Top achievements
Rank 1
answered on 28 Feb 2011, 08:02 PM
I tracked my issue down to having the below in the web.config, which I'd recently added about the same time I did the upgrade.  After removing it, combo functionality seems to be working as expected.

<telerik.web.ui>     

    <radCompression enablePostbackCompression="true" />

  </telerik.web.ui>

Tags
ComboBox
Asked by
nightvision miami
Top achievements
Rank 1
Answers by
Roger
Top achievements
Rank 1
Share this question
or