How to fill grid view with data?? , db Killeen, United States
  • 11 years ago


    I am practicing ASP.Net with Visual studio 2005 as my IDE and i get Difficult on
    how to fill the grid view with data ex: firstname,family name,MI,Adress,Phone_No 

    somebody can give me a hint or just a piece of code...

    many thanks in any reply....


  • 11 years ago

    hi aaronabdiel,
    If your data coming from database directly then you can hold data in either DataTable or DataSet. Then you can directly set DataTable OR DataSet as datasource of the gridview.
    gridview1.DataSource=DataTable;         OR    gridview1.DataSource=DataSet; 
    gridview1.DataBind();                                    gridview1.DataBind(); 

    Else you can add your data elements directly to ArrayList then you can set datasource of gridview as ArrayList.


    Hope this will help you.
    Thanks & Regards
    Dilip Kumar Vishwakarma
    .Net Consulting

    If this post is answer for your query then don't forget to mark as an answer.


Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan