devexpress gridview add new row with data source code example

Example: c# devexpress add new row at specific olumn

using DevExpress.XtraGrid;
using System;
using System.ComponentModel;

namespace SampleGridApplication {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
            this.Load += Form1_Load;
            //end-users cannot add rows
            gridView1.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False;
        }

        private void Form1_Load(object sender, EventArgs e) {
            //load sample data base
            gridControl1.DataSource = SampleDS();
        }

        private void button1_Click(object sender, EventArgs e) {
            //add a new row
            gridView1.AddNewRow();
            //set a new row cell value. The static GridControl.NewItemRowHandle field allows you to retrieve the added row
            gridView1.SetRowCellValue(GridControl.NewItemRowHandle, gridView1.Columns["Name"], "Please enter new value");
        }

        //sample data source
        public BindingList<Entry> SampleDS() {
            BindingList<Entry> ds = new BindingList<Entry>();
            ds.Add(new Entry("One", 1));
            ds.Add(new Entry("Two", 2));
            ds.Add(new Entry("Three", 3));
            ds.AllowNew = true;
            return ds;
        }
    }

    //sample data source entry
    public class Entry {
        public Entry() { }
        public Entry(string name, Int32 id) {
            Name = name; ID = id;
        }
        public string Name { get; set; }
        public Int32 ID { get; set; }
    }
}