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

RadGrid client side changes not persisted

4 Answers 317 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 11 Jun 2009, 01:13 PM
Hello,

I am new to Telerik and have downloaded the asp.net for evaluation. I have a simple RadGrid with 2 columns defined as

 

<telerik:RadGrid ID="RadGrid1" runat="server" onneeddatasource="NeedData" AutoGenerateColumns="False">

 

 

    <MasterTableView ClientDataKeyNames="NewCol1" Width="100%">

 

 

        <Columns>

 

 

            <telerik:GridBoundColumn DataField="rowId" HeaderText="rowId" Visible="false" UniqueName="rowId">
          
</telerik:GridBoundColumn>

 

 

            <telerik:GridBoundColumn DataField="NewCol1" HeaderText="NewCol1" ReadOnly="False" UniqueName="NewCol1">

 

 

            </telerik:GridBoundColumn>

 

 

        </Columns>

 

 

    </MasterTableView>
    <
ClientSettings>

 

 

        <Selecting AllowRowSelect="True"/>

 

 

        <ClientEvents OnRowDblClick="OnRowSelected" />

 

 

        <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="200px"/>

 

 

    </ClientSettings>

 

 

</telerik:RadGrid>

 

A DataTable is used as the data source on the server side. In the RadGrid, when you double click a row, a RadWindow is used to popup a window to edit the selected row's data. The popup window in turn calls my local js method to update the row with the new values. All is well and the examples I have followed work as expected. When I finally hit a save button on the page (which posts back to the server), I believe .Net is loading the view state of the RadGrid without the changes I have made to the grid. I kind of expected this given that .Net rebuilds the controls in the Init event. So I have two questions,

1) How do I get the changes I have made to the grid on the client side to the server, and/or
2) The RadWindow used to make the changes calls the js function BrowserWindow.myUpdateMethod which is all client side. If I cannot easily get the client side changes, how can I force the RadWindow to post back instead of calling my js function? In the past, we have used CodeSummit WebModalControls which does precisely that, which allows us to change the data client side and rebind.

Thanks for your help.

Paul

 


 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
answered on 11 Jun 2009, 01:16 PM
Hello again,

Sorry, the formatting of the code seemed to fail and the last sentence should read

"In the past, we have used CodeSummit WebModalControls which does precisely that, which allows us to change the data server side and rebind."

Cheers,

Paul
0
Georgi Krustev
Telerik team
answered on 16 Jun 2009, 12:34 PM
Hello Paul,

May I suggest you examine this online demo, which uses the client-side API of RadGrid, RadWindow and RadAjax to update the data on server side, and update the grid. Note that after the data is update on the server, you need to rebind the grid with the data.

Regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Paul
Top achievements
Rank 1
answered on 16 Jun 2009, 02:23 PM
Georgi,

I have already seen this. However, this example is dependent upon using a data source to update the data from the RadWindow and simply asking the datagrid to rebind with the updated result set. I do not want to hit the database until all changes have been made. in fact, I populate the data source on the server side using OnNeedDataSource. What I wanted to know is how to get RadWindow to postback with the row changes as an argument, which would allow me to make the changes to the data grid. This would allow me to make numerous changes which I could then commit at a later time (or discard all the changes made).

I know I could just call __doPostBack with custom event/argument values and pick it up in one of the Page events, but I was wondering if there was a way to do this withing the context of a RadWindow (like WebModalControls).

Cheers,

Paul
0
Georgi Krustev
Telerik team
answered on 18 Jun 2009, 11:50 AM
Hello Paul,

You can use ajaxRequest() of the RadAjax to make asynchronous request to the server. In general there is no a big difference between using ajaxRequest() and the __doPostBack method. For further information you can review this help article.
I am not familiar with other solution where the RadWindow could post back to the server with its client API. If you need more concrete information I will suggest you open a support ticket about RadWindow. Thus you will get more specific answer.

Best regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Paul
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or