More in this section
Forums / Sitefinity SDK / RadGrid Client Side Binding in Control Designer

RadGrid Client Side Binding in Control Designer

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Jeff
    Jeff avatar
    9 posts
    29 Nov 2009
    18 Jan 2011
    Link to this post

    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" />

  2. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    18 Jan 2011
    Link to this post
    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: (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.
2 posts, 0 answered