.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
satyapriyanayak
SP
Ashutosh Jha
ASPEvil

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Bind GridView with BindingSource Class

Posted By:Lakhan Pal Garg       Posted Date: June 16, 2010    Points: 10    Category: ASP.NET Controls    URL: http://lakhangarg.blogspot.com  

Bind GridView with BindingSource Class
 

First Steps is to create the object of BinduingSource Class As:

Dim bsGrid1 As New BindingSource


Get the data into a dataset from database using SqlDataAdapter.

DataSet dsMyData AS New DataSet()
dsMyData={Method to Get Data From database}


Now use the following code to bind the grid through binding source:
      

dgvMyGrid.DataSource = bsGrid1 
        bsGrid1 .DataSource = dsMyData
        bsGrid1 .DataMember = "Table1"  ' Table Name
        dgvMyGrid.BindingContext = Me.BindingContext()

Thanks & Regards
Lakhan Pal


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend