Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
12998 | Apr 17,2004 07:53 AM UTC | Apr 19,2004 06:05 AM UTC | WinForms | 3 |
![]() |
Tags: GridControl |
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); } } } }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.