RadGrid Disappears After Client Side Rebind

3 posts, 0 answers
  1. jlj30
    jlj30 avatar
    101 posts
    Member since:
    Jan 2011

    Posted 06 Apr 2014 Link to this post

    Hi,

    Here's my situation.

    I have a RadWindow (separate aspx page) that contains a grid within a RadAjaxPanel (also tried just a plain asp Panel).
    The grid is bound to a sqlDataSource.
    The grid loads just fine when the RadWindow is initially launched.

    The user fills out a few fields on the forms and clicks on Save.
    I then call a webservice from javascript that adds a new record to this data source.
    I now need to rebind the grid to show this newly added record.

    I'm using the following function:
    function RefreshGrid() {
                var grid = $find("<%= grdInputs.ClientID %>");
                var masterTable = grid.get_masterTableView();
                masterTable.rebind();
                // grid.repaint();  // tried adding this, but without any luck
            }

    I've tried adding the following to my RadAjaxManager without any success either (with and without the 1st AjaxSetting):
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="grdInputs" />
        </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:AjaxSetting AjaxControlID="grdInputs">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="grdInputs" />
        </UpdatedControls>
    </telerik:AjaxSetting>

    What am I doing wrong?

    Thanks in advance for any assistance.

    Jim

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 06 Apr 2014 in reply to jlj30 Link to this post

    Hello,

    You want to bind datasource in Server Side and Clinet side. But RadGrid is not supported those bind binding in the one Radgrid.

    You can use either Clinet side binding or Server side binding.


    Below code snippet is only works when you will use clinet side binding. (You already used SqlDataSource to bind your grid that means you have used Server side binding).
    function RefreshGrid() {
                var grid = $find("<%= grdInputs.ClientID %>");
                var masterTable = grid.get_masterTableView();
                masterTable.rebind();
                // grid.repaint();  // tried adding this, but without any luck
            }
    Let me know if any concern.

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jlj30
    jlj30 avatar
    101 posts
    Member since:
    Jan 2011

    Posted 07 Apr 2014 in reply to Jayesh Goyani Link to this post

    Hi,

    I found the problem.
    I had specified an OnInit handler for the sqlDataSource that populated a selectParamater.
    This works fine for the initial rendering of the grid, but appears to not be fired when the client side rebind occurs.
    I removed the OnInit and use a ControlParameter referencing a textbox instead.
    Everything works fine now.

    So Jayesh, I am not doing client side binding.  The rebind method called in the above code snippet must result in an Ajax callback that refreshes my grid.

    Jim
Back to Top