LoadOnDemand doesn't work when you do binding in code

3 posts, 0 answers
  1. nightvision miami
    nightvision miami avatar
    6 posts
    Member since:
    Apr 2010

    Posted 24 Feb 2011 Link to this post

    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. Roger
    Roger avatar
    38 posts
    Member since:
    May 2008

    Posted 28 Feb 2011 Link to this post


    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
  3. Roger
    Roger avatar
    38 posts
    Member since:
    May 2008

    Posted 28 Feb 2011 Link to this post

    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>

Back to Top