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


Top 5 Contributors of the Month
david stephan

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

gridview binding through datatable

Posted By: Catherine     Posted Date: November 17, 2011    Points:5   Category :VB.Net
Hi i would like to bind gridview through looping. but it binds only one row. how to bind the gridview through looping. my datatable contains two rows and three columns this is my code

If objdt.Rows.Count > 0 Then

For i = 0 To objdt.Rows.Count - 1

--here i like to bind gridview with condition

next

end if

Responses
Author: Narayanan             
Posted Date: November 17, 2011     Points: 20   

Hi,
try this
If objdt.Rows.Count > 0 Then

For i = 0 To objdt.Rows.Count 0

--here i like to bind gridview with condition

next

end if


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Syed Shakeer Hussain             
Posted Date: November 19, 2011     Points: 20   

Hi,
Use the below code for binding dataTable to the Grid

If objdt.Rows.Count > 0 Then

GridView1.DataSource=objdt;
GridView1.DataBind();

end if




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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