How to use gridview

Discussion in 'ASP .Net Web Controls' started by enak, Jun 26, 2006.

  1. enak

    enak Guest

    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
    enak, Jun 26, 2006
    #1
    1. Advertising

  2. enak

    Raven Guest

    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>
    Raven, Jun 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nalaka

    GridView in a GridView

    Nalaka, Nov 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    6,606
    Nalaka
    Dec 5, 2005
  2. Replies:
    3
    Views:
    5,113
  3. Carlos Albert

    GridView in a GridView

    Carlos Albert, Dec 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    499
    Carlos Albert
    Dec 6, 2005
  4. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,965
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  5. Chris S
    Replies:
    0
    Views:
    455
    Chris S
    Dec 13, 2006
Loading...

Share This Page