Home Forums WinForms controls Xceed Grid for WinForms Default values in insertrow

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15465 |

    Hello,

    How i can define a default value for each cells on a insertrow?

    In advance tanks you

    Imported from legacy forums. Posted by Laurent (had 1746 views)

    User (Old forums)
    Member
    Post count: 23064

    You can set the IdleValue property on the InsertionCell, and use it to set the value of the new DataRow if the user has not set it explicitly.

    <code>
    private void Form1_Load(object sender, EventArgs e)
    {
    //set the default value in the InsertionCell
    ( ( InsertionCell )insertionRow1.Cells[ 1 ] ).IdleValue = “other company”;
    gridControl1.AddingDataRow += new AddingDataRowEventHandler( gridControl1_AddingDataRow );
    }

    void gridControl1_AddingDataRow( object sender, AddingDataRowEventArgs e )
    {
    //use the idle value to set the value of the corresponding cell of the DataRow
    e.DataRow.Cells[ 1 ].Value = ( ( InsertionCell )insertionRow1.Cells[ 1 ] ).IdleValue;
    }
    </code>

    Imported from legacy forums. Posted by André (had 2973 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.