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

Reading data from "Add new record" in Grideditmode.Inplace

2 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 02 Jun 2015, 12:16 PM

Hi Team,

I am using radgrid in "put all fields in edit" mode, achieving through the below code .

        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            RadGrid1.AllowMultiRowEdit = true;
            RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;
            foreach (GridDataItem dataItem in RadGrid1.Items)
            {
                dataItem.Edit = true;
            }
            RadGrid1.Rebind();
         }

 

Also I used  "RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;" , in order to create a new row to the grid.

Now I need to read all newly entered values from a button.

Please help.

 

Ramesh

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 05 Jun 2015, 07:39 AM
Hi Ramesh,

You can use the following approach to access the insert item values on a button click.
protected void Button1_Click(object sender, EventArgs e)
{
    GridEditableItem insertItem = RadGrid1.MasterTableView.GetInsertItem();
 
    foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
    {
        string cellValue = insertItem[col.UniqueName].Text;
    }
}

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ramesh
Top achievements
Rank 1
answered on 08 Jun 2015, 01:18 PM

Thanks for your reply, but I couldn't get achieve with your code, however from  your suggestion , I got a clue  and find the solution.Here is the code .

if (RadGrid1.MasterTableView.IsItemInserted)
{
           GridEditableItem i = (GridEditableItem)RadGrid1.MasterTableView.GetInsertItem();
            TextBox r = (TextBox)i["Name"].Controls[0];

}

Again thanks for your reply.

Regards

Ramesh.

Tags
Grid
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Ramesh
Top achievements
Rank 1
Share this question
or