C#.net

Add Row to Datatable



Here is the code in C#.net which can be used to add rows dynamically to a datatable..This datatable can be made the sourse of a data grid to display the dynamically added row.

DataTable dt = new DataTable();

 DataRow dr = dt.NewRow();

            dr["Option"] = txt_Opt.Text;

            dt.Rows.Add(dr);

            dg_Opt.DataSource = dt;

Share

Thanks for reading my blog. If you like what I write, why not subscribe to my feed?

If you are busy, I can send the latest post to your email. Just subscribe to my email updates.

 

Enter your email address:

Delivered by FeedBurner

Discussion

No comments for “Add Row to Datatable”

Post a comment