winforms - How to enable editing for new inserted row in a GridView while gridview is allowedit = false? -


I have a GridView control of the xtraGrid suite in a form when I open the form for the first time, this is AllowEdit = false . I want to press the new line link (built in control) to make the newly inserted row editable, then I have read that I should use an e-mailing event, but I do not know how I It's written but it does not make the row editable:

  Private Zero Grid Visibility Sender (Object Sender, System.ComponentModel.CancelEventArgs e) {// This is the first tryout // If (gridViewNote IsNewI TemRow (gridViewNote.FocusedRowHandle)) // == gridViewNote.GetFocusedDataRow ()) // {// gridColumnStagione.OptionsColumn.AllowEdit = true; //} // second tryout GridView View = GridView as sender; SchedeMaterialiDaTaglioDS.SMTAGL_NOTERow currentRow = gridViewNote.GetFocusedDataRow () as SchedeMaterialiDaTaglioDS.SMTAGL_NOTERow; SchedeMaterialiTaglioDS.SMTAGL_NOTEDataTable ChangeTableBase = DSTMTTagLio SMGL_Note GetChanges () as SchedeMaterialiDaTaglioDS.SMTAGL_NOTEDataTable; E.Cancel =! View.IsNewItemRow (see Focused Road Handle) & amp; Amp; ! ChangesTable.Contains (currentRow); // set.Inserts.Contains (command); }    

I hope I understand your question. Some simple ways to do this:

  1. By adding a repository item to each column and handling the editor / <> event, e.Cancel's Using if it is considered to be read only.

  2. By lifting a window / text box, let the user enter the value and add a row with values ​​already inserted by the code.

  3. Specify two different repository items in the same column using gridView.CustomRowCellEdit events such as:
     < Code> repositoryitamtext adit rep = new repository etc. (); RepositoryTexttextNoRIP = new repositorytetech edit (); NoRep.ReadOnly = True; Private Zero Button 1_Click (Object Sender, EventArgs e) {gridView1.AddNewRow (); JustAddedName = True; GridView1.RefreshData (); } Private void gridView1_CustomRowCellEdit (object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) {if (e.Column == colname) {if (e.RowHandle == gridView1.RowCount - 1 & amp; & amp; justAddedName) {E .RepositoryItem = rep; } And {e. Repository Itam = Norp; }}}     

    This is not complete, just to find a direction.

    Hope I helped.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -