Hopefully this is an easy question - is there a RadGrid method I can call to tell the grid to save all changes when it's in edit mode? I must call it from the codebehind page - not through a button in the grid.
What I want is basically a Telerik equivalent of the DevExpress ASPxGridView.UpdateEdit() method, if that makes sense.
This is for an asp:Wizard that contains a RadGrid. I keep all rows in my RadGrid in edit mode while the user is browsing through different steps in the wizard. Then at the end of the wizard I want to save changes.
Thanks in advance!
What I want is basically a Telerik equivalent of the DevExpress ASPxGridView.UpdateEdit() method, if that makes sense.
This is for an asp:Wizard that contains a RadGrid. I keep all rows in my RadGrid in edit mode while the user is browsing through different steps in the wizard. Then at the end of the wizard I want to save changes.
Thanks in advance!
4 Answers, 1 is accepted
0
Kelly
Top achievements
Rank 1
answered on 20 Aug 2010, 09:46 PM
By the way, this is what I did for now as a workaround ... if there's a cleaner way to do this let me know, but I won't get my hopes up.
Again and again I find that DevExpress exposes the useful/intuitive properties and methods that make my job easy and my code clean...Telerik usually does not. Story of my life!
Again and again I find that DevExpress exposes the useful/intuitive properties and methods that make my job easy and my code clean...Telerik usually does not. Story of my life!
public
void
SaveChangesInDatabase(
int
projectProgramID)
{
ProgramStateDataSource.UpdateParameters[
"ProjectProgramID"
].DefaultValue = Convert.ToString(projectProgramID);
Hashtable newValues =
new
Hashtable();
foreach
(GridItem item
in
RadGrid1.Items)
{
if
(item
is
GridEditableItem)
{
item.OwnerTableView.ExtractValuesFromItem(newValues, (GridEditableItem)item);
ProgramStateDataSource.UpdateParameters[
"StateID"
].DefaultValue = Convert.ToString(newValues[
"StateID"
]);
ProgramStateDataSource.UpdateParameters[
"Allowed"
].DefaultValue = Convert.ToString(newValues[
"Allowed"
]);
ProgramStateDataSource.UpdateParameters[
"RetailPriceLimit"
].DefaultValue = Convert.ToString(newValues[
"RetailPriceLimit"
]);
ProgramStateDataSource.Update();
}
}
}
0
Hello Kelly,
There is UpdateEdited command that could be triggered in RadGrid which will result in firing UpdateCommand for all items that are in edit mode currently. You can check the following example:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/commanditem/defaultcs.aspx
The grid on top have button Update that will update all currently edited items.
Regards,
Nikolay
the Telerik team
There is UpdateEdited command that could be triggered in RadGrid which will result in firing UpdateCommand for all items that are in edit mode currently. You can check the following example:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/commanditem/defaultcs.aspx
The grid on top have button Update that will update all currently edited items.
Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kelly
Top achievements
Rank 1
answered on 26 Aug 2010, 03:21 PM
Thanks for the reply, unfortunately a button with Command="UpdateEdited" wouldn't work in this scenario because I need to initiate the update from the codebehind, not from a button. There are many things I need to do at the end of the wizard and updating this grid is just one of them so I can't tie the finish button of the wizard to just this grid. However, I already got it working with the code I posted so I'm good.
0
Hello Kelly,
You can use the following code to achieve this:
Regards,
Nikolay
the Telerik team
You can use the following code to achieve this:
UpdateAll.Click += (s, a) =>
{
Grid.MasterTableView.Items[0].FireCommandEvent(RadGrid.UpdateEditedCommandName,
null
);
};
<
asp:Button
Text
=
"Update All"
runat
=
"server"
ID
=
"UpdateAll"
/>
<
telerik:RadGrid
runat
=
"server"
ID
=
"Grid"
AutoGenerateColumns
=
"false"
AllowMultiRowEdit
=
"true"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
></
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
></
telerik:GridEditCommandColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items