Hello,
I want to add/insert new empty row on the top of selected row as in excel sheet.
I have alredy one record binded in webgrid. I have shown popup to and button to Add new row when click in cell. Now if click on Add new row button i want to add new row on top of selected row.
I need to add textbox in each cell to edit that values.
For already binded webgrid my code is as below
CellETemp =
();
CellETemp.Append(
);
So how can i do that
Thanks,
Nandu.
Hi,
To insert a row above the currently active cell, you could use a code similar to the following two methods:
void GetActiveRowInfo(XamGrid grid, out RowCollection rows, out Row row)
{
row = null;
rows = null;
if (grid.ActiveCell == null)
return;
row = grid.ActiveCell.Row as Row;
rows = grid.GetRowCollection(row);
}
void InsertAboveActiveRow(XamGrid grid)
RowCollection rows = null;
Row existingRow = null;
Row insertRow = null;
grid.GetActiveRowInfo(out rows, out existingRow);
if ((rows == null) || (existingRow == null))
throw new InvalidOperationException("Could not find the Row to insert above.");
insertRow = rows.CreateItem();
rows.Insert(existingRow.Index, insertRow);
HTH,