How to fill grid view with data??

asp.net , db Killeen, United States
  • 13 years ago

    Hi

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

    http://www.dcglobal.us
    http://www.neuracom.com
     

     

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

    gridview1.DataSource=ArrayList; 
    gridview1.DataBind();   

    Hope this will help you.
    Thanks & Regards
    Dilip Kumar Vishwakarma
    Programmer
    .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).

Contribute

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.

“UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.” - Dennis Ritchie