Binding Columns in DatagridView C#
My problem is in my webpage i have a datagridview and i would like to populate it with data from my sql Db. my way was to link the Datagridview with a table from my Dataset, also as long as i have Data fields linking to the correct columns from table mentioned in my markup page( ). it all works.
i did not like the way how i bounded the columns to the datagridview columns.
could somebody please suggest a better way? using pure c# code only and not have to do anything with the markup page.
Thanks for your time
Adrian
Master BillaPosted Aug 12, 2009, 10:39 PM
When you are allow to gridview AutoGenerateColumns is true, then it will handle the all columns(you don't give the data fields name to every columns).
Just give make it your gridview is AutoGenerateColumn is true then take look.
Thank you
adrian WonderPosted Aug 12, 2009, 7:09 PM
Master BillaPosted Aug 12, 2009, 4:32 AM
You add gridview in htm page.
Then add code like this way
Then you can bind data to gridview.
thank you
adrian WonderPosted Aug 12, 2009, 1:47 AM
Roei BarPosted Aug 12, 2009, 1:33 AM
you will get back a dataset
and no the dataset you can do the following
you can use DAAB here is the download link :
http://geekswithblogs.net/mnf/archive/2007/03/19/109142.aspx