RadGrid Client Side Binding in Control Designer - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

RadGrid Client Side Binding in Control Designer

  • RadGrid Client Side Binding in Control Designer
  • I have added a RadGrid to a control designer attached to a User Control Widget, based on the standard examples for RadGrid client-side programatic databinding and Sitefinity 4 control designers.  Everything is working as I expected except that the control designer's script is populating the control parameter values after the RadGrid's OnDataBinding client side event.

    That's a problem since the RadGrid needs the controls parameters to pass them to the web service datasource.

    For example:

    The control designer's script to populate control properties

    refreshUI: function ()
        var data = this._propertyEditor.get_control();
        var param = data.CategoryCode;
        if (param == null) param = "";

    happens before the RadGrid databinding event that fills in the value in #uiCategoryCode

    function productsGrid_DataBinding(sender, args)
        var methodArguments = args.get_methodArguments();
        var myMethodArguments = new Object();
        myMethodArguments.Category = jQuery("#uiCategoryCode").val();

    Resulting in the "CategoryCode" parameter being empty during databinding, but have the correct value later on.

    In fact, if I fill in the value in the textbox myself it works perfectly.  So I just need to change the order so databinding happens after "refreshUI".

    For reference, this is how I'm telling the RadGrid which javascript method to use: 
        <DataBinding SelectMethod="GetCategorizedProducts3" Location="/WebServices/CategoryLinks.asmx"
            SortParameterType="Linq" FilterParameterType="Linq">
        <ClientEvents OnDataBinding="productsGrid_DataBinding" />

  • Hello Jeff Dease,

    The problem occurs, because you are binding the grid declaratively. When binding the grid this way, it calls the webservice on page load or later, but after the control designer's refreshUI method. What you can do is manually bind the grid in client-side code in the refreshUI method itself. That's what we are doing in the built-in control designers, too.
    You can find more information about how to do this here: http://www.telerik.com/help/aspnet-ajax/grid-live-data-from-web-service.html (just do it once and not after a predefined interval with live data).

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.