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

updatecommand on radgrid where inserted items are saved in viewstate

4 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carina
Top achievements
Rank 1
Carina asked on 10 Jan 2013, 10:53 PM
So I am trying to figure out how to build the code behind for the updatecommand on a radgrid where the records I senrt are saved in viewstate, and once the user clicks on "save" button on the form, those records are saved on the db along with other data on the form. I am not sure how to go about updating? when I click the "edit selected" button, the record on the radgrid either disappears or opens up blank in the edit form, and one i hit update...nothing happens. how can I do this?

4 Answers, 1 is accepted

Sort by
0
Carina
Top achievements
Rank 1
answered on 11 Jan 2013, 10:45 PM
for example on my insert command it looks a little like this:

Dim

 

 

item As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
Dim name as string = DirectCast(item.FindControl("cbName"), RadComboBox).Text
Dim address as string = DirectCast(item.FindControl("cbAddress"), RadComboBox).Text
Dim birthday as string = DirectCast(item.FindControl("cbBirthday"), RadComboBox).Text

dim table as new Table1
table.attribute1 = name
table.attribute2 = address
table.attribute3 = birthday
ViewStateVariable.Add(table)

so how would update command look?

0
Pavlina
Telerik team
answered on 15 Jan 2013, 04:46 PM
Hello Carina,

I believe the help article below will help you achieve the desired functionality:
http://www.telerik.com/help/aspnet-ajax/grid-insert-update-delete-at-database-level.html

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Carina
Top achievements
Rank 1
answered on 15 Jan 2013, 05:08 PM
Hi Pavlina,

I am using EF with this project, is there a different way to go about it? I have looked at that example before but did not work with my project.
0
Pavlina
Telerik team
answered on 18 Jan 2013, 12:58 PM
Hi,

Can you verify that you are not using simple databinding calling DataBind() to bind the grid? This article demonstrates how to update a grid row when the user edits it using edit form. Give the attached examples a try and see if one of the presented approaches works for you.

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Carina
Top achievements
Rank 1
Answers by
Carina
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or