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

RadGrid Disappears After Client Side Rebind

2 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jlj30
Top achievements
Rank 2
jlj30 asked on 07 Apr 2014, 12:11 AM
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 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Apr 2014, 04:31 AM
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
0
jlj30
Top achievements
Rank 2
answered on 07 Apr 2014, 01:42 PM
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
Tags
Grid
Asked by
jlj30
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
jlj30
Top achievements
Rank 2
Share this question
or