How to fill grid view with data?? , db Killeen, United States
  • 10 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....


  • 10 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.

“Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.”