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

RadGirs with Editable user control question

5 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 03 Jun 2008, 08:08 PM
Hi all,

I have been using the radGrid and the editable user control for most of my pages.  Works great.  But now I want to do something a little difference with this same technique.  Here is what I'd like to do:

I have a radGrid on my page with an Edit button that when clicked, calls the user control.  The user control displays with a few telerik controls.  The user enters some data.  The user clicks the Update button.  But instead of updating the database like I normally do, I want to only update the radGrid row that was clicked with the values that the user entered.  So how would I do this?

Thanks,
Bob

5 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 05 Jun 2008, 05:54 AM
Hello Bob,

You can implement the desired functionality in the UpdateCommand handler of your RadGrid, where instead of updating the database, you would only modify the values of your current item.

Best wishes,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Bob
Top achievements
Rank 1
answered on 05 Jun 2008, 11:44 AM
Ok Veli, thanks.  I thought that was the proper event.  But I need help trying to make the changes to the grid here.  Maybe you could show me how.

Thanks,
Bob
0
Veli
Telerik team
answered on 05 Jun 2008, 04:38 PM
Hi Bob,

First of all, we need to mention that the UpdateCommand event is designed to update the data source of RadGrid. Therefore, after the command is executed, RadGrid rebinds to its data source to refresh its data. If you need to update only your RadGrid data without modifying the data source, a suggested approach would be to load your data source to the view state of your application and bind your data to the object in the viewstate instead of the real data source, as described in this online help article:

Performing batch updates

If this is not an option for you, in the UpdateCommand handler, you can place your edited values in a Session object, from where you can get them in the PreRender event of RadGrid and set them as values for the respective item in Radgrid. This is demonstrated in the attached sample project. Please note that after such a custom update, when another command requiring data rebind is triggered, RadGrid rebinds to its original data source. Thus, changes from the custom update are not persisted, as the actual data source is not modified.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jim
Top achievements
Rank 1
answered on 31 Oct 2008, 10:04 PM
I'm trying to use a WebUserControl to update my RadGrid and database, but when I click update, the detail form disappears briefly and then reappears without updating anything.

I decided to compare my program to AJAXGridUpdateExample.zip (downloaded from this thread) and try to figure out what's wrong.  However, AJAXGridUpdateExample.zip doesn't work on my computer under 2008 Q2, either as downloaded or after I removed all the code in the codebehind page to try a simple automatic updates.

Can anyone tell me what's wrong?
0
Iana Tsolova
Telerik team
answered on 03 Nov 2008, 04:21 PM
Hello James,

I tried the sample from the AjaxGridUpdateExample.zip with RadControls for ASP.NET AJAX Q2 and it worked as expected on my end.

However possible reason your grid to stay in edit mode after update is that the update failed. Therefore if you are using automatic operations, please check if your update command is properly defined. You can find further information about RadGrid updating in the following resources:

http://www.telerik.com/help/aspnet-ajax/grdautomaticdatasourceoperations.html
http://www.telerik.com/help/aspnet-ajax/grdupdatingvaluesusercontrolformtemplate.html

Check it out and let me know how it goes.

Kind regards,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Veli
Telerik team
Bob
Top achievements
Rank 1
Jim
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or