GridView, please help fast!

2 views
Skip to first unread message

Nilukshi Tharanga Ekanayake

unread,
Jul 28, 2006, 5:57:52 AM7/28/06
to DotNetDe...@googlegroups.com

Dear all,

I am quite new to ASP.NET 2.0. Could any one tell me how to bind a GridView using a Data Set?

Thank you in advance.

Regards,

Nilukshi.T.E



Don't just search. Find. MSN Search Check out the new MSN Search!

Bradley, Peter

unread,
Jul 28, 2006, 7:41:44 AM7/28/06
to DotNetDe...@googlegroups.com

Sevinfooter

unread,
Jul 28, 2006, 9:42:25 AM7/28/06
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
One of the beautiful aspects of asp.net 2.0 is that you do not have to
use a dataset to bind your gridview to the database. You can use
datasource objects, and bind your gridview to the datasource with the
datasourceid="sqldatasource1" tag in the gridview.

http://asp.net/QuickStart/aspnet/doc/ctrlref/data/default.aspx
this link has a whole host of tutorials and examples for the new 2.0
stuff in asp.net

Raghuraman_ace

unread,
Jul 29, 2006, 1:18:13 AM7/29/06
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi

This is one of the simplests.

fill u r dataset using the dataadapter's fill method.
then bind the datatable with the grid like

datagrid.datasource=ds.tables[0]'defaultview.

hope this helps.

a drop in the ocean of six faces
Raghuraman.Tricomp tech india
Tricomp te

raghav

unread,
Jul 29, 2006, 1:27:50 AM7/29/06
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi

Don't Worry, foolow this link
http://www.asp.net/learn/dataaccess/
Ur issue will be surely resolved

Regards
Raghav Mahajan

Ashok Kumar

unread,
Jul 31, 2006, 12:49:54 AM7/31/06
to DotNetDe...@googlegroups.com
Hi Friend,
 
Now Im sending the code to bind a gridview in VB.net. I hope it will very help ful & useful for U
 
dim Con as system.data.sqlclient.SqlConnection("Server=ServerName;Database=Master;UID=User ID;PWD=Password")
dim Query as String="Select * from Employee"
dim DA as system.data.sqlclient.SqlDataAdapter
dim DS as new dataset
dim iCount as integer
 
sub BindGridView()
DA=new system.data.sqlclient.SqlDataAdapter(Query,Con)
iCount=da.fill(ds,"Emp")
if iCount > 0
GridView1.DataSource=ds.tables("Emp")
endif
end Sub

 
--
Ashok Kumar
Reply all
Reply to author
Forward
0 new messages