Bind the grid view from text boxes in C#.net

Bind the grid view from text boxes in C#.net


in this article i am binding gridview though textboxes. To do this i have to make first an imaginary table (Data table) and then provide it source to gridview.


DataTable table = new DataTable();//making data table

            table.Columns.Add("ID", typeof(int));//add columns
            table.Columns.Add(" Name", typeof(string));
            table.Columns.Add("gender", typeof(string));
            table.Columns.Add("Date", typeof(DateTime));

            
            //  add  Rows.
           
            table.Rows.Add(1, "Umar", "Male", DateTime.Now);
            table.Rows.Add(2, "Hayat", "Male", DateTime.Now);

           //binding with gridview
            GridView1.DataSource = table;
            GridView1.DataBind();

by Hafiz Muhammad Umar Hayat...........

Comments