Home All Groups Group Topic Archive Search About
Author
26 Jun 2006 4:56 PM
enak
I am new to ASP.NET 2.0 and am trying to use the gridview in an application.
I am used to using the datagrid and being able to bind it to a datareader
programmatically.

Is there a way to do that with the gridview? Here is what I have tried but
it is not visible:

sSQL =

"Select c.ClientName, a.lName + ', ' + a.fName + ' ' + a.middleInitial AS
ApplicantName," & _

"a.OrderedBy, a.DateOrdered " & _

"from tblApplicant AS a JOIN tblClient AS c ON a.ClientID = c.ClientID " & _

"Where DatePosted Is null"
dr = cDb.getDataReader(sSQL)


Me.gridNewRequests.DataSource = dr

Me.gridNewRequests.DataBind()

Me.gridNewRequests.Visible = True
cDb.closeConnection()

As you can see I am not using an SQLDataSource. Do you have to use it or can
I do it the way I am?

Please help me with this.

Thanks,

enak

Author
30 Jun 2006 8:40 AM
Raven
yes, you can programmatically bind a GridView using the DataSource
property

<a
href="http://authors.aspalliance.com/aspxtreme/webforms/controls/addinggridviewcontrolstowebformspage.aspx">Adding
GridView Controls to a Web Forms Page</a>