private void gridDataBoundGrid1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if(cc.RowIndex == this.gridDataBoundGrid1.Model.RowCount)
{
//dt is a DataTable that is the grid''s DataSource
DataRow dr = this.dt.NewRow();
dr["Col2"] = "someDefaultvalue";
this.dt.Rows.Add(dr);
}
}
>private void gridDataBoundGrid1_CurrentCellStartEditing(object sender, CancelEventArgs e)
>{
> GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
> if(cc.RowIndex == this.gridDataBoundGrid1.Model.RowCount)
> {
> //dt is a DataTable that is the grid''s DataSource
> DataRow dr = this.dt.NewRow();
> dr["Col2"] = "someDefaultvalue";
> this.dt.Rows.Add(dr);
> }
>}
>
private void gridModel_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
DataObject data = (DataObject) Clipboard.GetDataObject();
if(data.GetDataPresent(DataFormats.Text))
{
string s = (string)data.GetData(DataFormats.Text);
string[] rows = s.Split(new char[]{''\n''});
int numRows = rows.GetLength(0);
if(numRows > 0 && rows[numRows - 1].Length == 0)
numRows--; //remove extra empty row if present
int numCols = 0;
if(numRows > 0)
{
string[] cols = rows[0].Split(new char[]{''\t''});
numCols = cols.GetLength(0);
while(this.gridDataBoundGrid1.CurrentCell.RowIndex + numRows
> this.gridDataBoundGrid1.Model.RowCount)
{
DataRow dr = dt.NewRow();
dr["Col2"] = "someDefaultvalue";
dt.Rows.Add(dr);
}
}
}
}