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

[Solved] RadGrid PerformInsert with SessionDataSource

3 Answers 216 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahmoud
Top achievements
Rank 1
Mahmoud asked on 24 Feb 2013, 07:08 AM

I have a RadGrid binded to a SessionDataSource .

and I want to fire RadGrid PerformInsert Command, I don't want to use the SessionDataSource
Insert() Function
 because the values has to be sent into an IDictionary Type. anyway I want to fire the insert command from the Grid itself by assigning the DefaultValues of the SessionDataSource<InsertParameters>.

OR ,

If I just knew how convert a DataTable or DataSet into IDictionary Type with a For Loop through Table Rows , It will acheive the Goal.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Feb 2013, 05:18 AM
Hi,

One suggestion is that you can use FireCommand to invoke InsertCommand as shown below.
C#:
RadGrid grid = (this.FindControl("RadGrid1") as RadGrid);
(grid.MasterTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem).FireCommandEvent(RadGrid.PerformInsertCommandName, string.Empty);

Thanks,
Shinu
0
Mahmoud
Top achievements
Rank 1
answered on 25 Feb 2013, 08:06 AM
Hi ,

Error : insert Item is available only in insert mode .
I want to fire insert command while the grid is not in insert mode.

Thanls,
0
Shinu
Top achievements
Rank 2
answered on 26 Feb 2013, 08:25 AM
Hi,

Please try the following code snippet.

C#:
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
   e.Item.OwnerTableView.IsItemInserted = true;
   RadGrid1.Rebind();
}

Thanks,
Shinu.
Tags
Grid
Asked by
Mahmoud
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mahmoud
Top achievements
Rank 1
Share this question
or