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

Client Side Insert/Update Question

3 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon Slezak
Top achievements
Rank 2
Brandon Slezak asked on 18 Nov 2010, 04:03 AM
Hi All,

I'm looking at the online demo for client side insert, update, delete.

My only problem with it is that it employs the use of a totally separate web service, and does most everything using manual javascript.

I like the RadComboBox, it has an OnItemsRequested event, and while being AJAX, doesn't require a web service to run.  It's just a server side event of the control.

 

<telerik:RadComboBox ID="ProductComboBox" visible="true" runat="server" 
                    EnableViewState="true" Width="350px" Height="150px" EmptyMessage="Select a Product" 
                    EnableLoadOnDemand="True" OnItemsRequested="ProductComboBox_ItemsRequested" 
                    OnTextChanged="ProductTextChange" autoPostBack="false" AllowCustomText="True">
                    </telerik:RadComboBox>


Is there a way to do RadGrid, having client side controls that update the grid client side, and then call SqlDataSource objects server side using an eventing structure?

Is that currently possible with RadGrid?

It just seems a bit extraneous to have to build all of the items by hand, updates by hand in javascript, and then calls to a webservice when I'd rather use SqlDataSources with updates and server side events.

Any help you could provide is appreciated!

-Brandon

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 23 Nov 2010, 04:08 PM
Hi Brandon,

Such kind of client-side controls are currently not supported by RadGrid. The whole notion of the event-based communication is connected with the use of server-side controls. Currently the RadGrid supports client-side binding only for web services and page methods. You can check this online demo where an approach for binding to page methods is shown. There you can retrieve the data using your prefered approach (SqlDatasource, SqlDataReader, etc.) and then this method is called on the client.
The other CRUD operations like update/delete also can be achieved in similar way, just through a method call of service or page, but the work for the actual extraction and sending of the values for the item still has to be done.

Greetings,
Marin
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Brandon Slezak
Top achievements
Rank 2
answered on 28 Nov 2010, 05:24 AM
I found what I was looking for.

For future reference the RadAjaxManager does what I need, I just didn't understand it initially.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" 
       onajaxrequest="RadAjaxManager1_AjaxRequest">
       <AjaxSettings>
           <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
               <UpdatedControls>
                   <telerik:AjaxUpdatedControl ControlID="txtPrice"></telerik:AjaxUpdatedControl>
               </UpdatedControls>
           </telerik:AjaxSetting>
       </AjaxSettings>
   </telerik:RadAjaxManager>


I ended up using the RadAjaxManager with the custom fire event.  So basically any javascript event I want calls the Ajax command to code behind without requiring complicated web service setup.

The trick was to set the RadAjaxManager itself to the AjaxControlID source (which wasn't intuitive).  Most samples had a grid or textbox sourcing the event.  But when you want to fire it off a custom event, like txtQuantity keypress to ajax update txtPrice, this was required.

I ended up doing grid edits on postback, but in hindsight, I could have used the RadAjaxManger, and sourced the event from my Save Button, then the theoretically my AjaxUpdatedControl could have been the grid, and that would be real simple.

My save button click server side could have done all my SqlDataSource updates for me without requiring me to create a separate web service.

Something to consider for the client side insert/update/delete demo as it doesn't really use the RadAjaxManager. - Client Side Insert/Update/Delete.    Is there any particular reason this aforementioned sample uses a Script Manager instead of a RadAjaxManager??
0
Marin
Telerik team
answered on 29 Nov 2010, 01:45 PM
Hi Brandon,

On you last questions, I suppose you meant RadScriptManager (instead of RadAjaxManager which is a different control). So one of the main differences between the standard script manager and the RadScriptManager is that the RadScriptManager automatically combines all request to client-side scripts into one and thus decreases the load time and optimizes the page performance. You can find more info on the RadScriptManager in the help article.

Hope this helps, feel free to ask if you have any other questions.

Regards,
Marin
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Brandon Slezak
Top achievements
Rank 2
Answers by
Marin
Telerik team
Brandon Slezak
Top achievements
Rank 2
Share this question
or