Results 1 to 7 of 7

Thread: [2005] Gridview Datasource

  1. #1

    Thread Starter
    Junior Member Righteous_trespasser's Avatar
    Join Date
    Feb 2007
    Location
    Pretoria, South-Africa
    Posts
    31

    [2005] Gridview Datasource

    Hi there, I have got a web-page with a grid view on it, initially there is no data source bound to the grid ... When I press a button, I want the datasource to be set, now I tried the following code but absolutely nothing happens ... where's the mistake that I'm making ... ?
    Code:
        Protected Sub ButtonSelectCourse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSelectCourse.Click
                Label1.Text = "RadioButton1"
                GridView1.DataSource = AccessDataSourceFDES1
                GridView1.DataBind()
                GridView1.Visible = True
                Dim n As Integer = GridView1.Rows.Count
        End Sub
    where I say "Dim n as integer = Gridview1.Rows.Count", I just used that to see if there was infact any changes made and the grid was maybe invisible or something, but the count is 0 ...
    Righteous_Trespasser
    "Be Good, And If You're Not, Be Good At It"

    www.dessoft.co.za

  2. #2
    Hyperactive Member kayos's Avatar
    Join Date
    Apr 2004
    Location
    Largo, Florida
    Posts
    306

    Re: [2005] Gridview Datasource

    hmmm... i've never tried anything like this, but i do have a suggestion.

    instead of:
    GridView1.DataSource = AccessDataSourceFDES1
    GridView1.DataBind()

    try this:
    GridView1.DataSourceID = "AccessDataSourceFDES1"
    GridView1.DataBind()

    because i assume that AccessDataSourceFDES1 is an actual DataSource object on your page and not something you are creating programmatically.


    If this post helps, please RATE MY POST!

    Using Visual Studio 2005 SE

  3. #3

    Thread Starter
    Junior Member Righteous_trespasser's Avatar
    Join Date
    Feb 2007
    Location
    Pretoria, South-Africa
    Posts
    31

    Re: [2005] Gridview Datasource

    Yes it is an actual DataSource lying on the page, but the ID thing doesn't work either, and I know the DataSource contains Data ... 12 rows of it ...
    Righteous_Trespasser
    "Be Good, And If You're Not, Be Good At It"

    www.dessoft.co.za

  4. #4

    Thread Starter
    Junior Member Righteous_trespasser's Avatar
    Join Date
    Feb 2007
    Location
    Pretoria, South-Africa
    Posts
    31

    Re: [2005] Gridview Datasource

    Seeing that that way of doing it doesn't really want to work ... how about this ... Is there a way to change the Datasource's query and then just refresh the Gridview?
    Righteous_Trespasser
    "Be Good, And If You're Not, Be Good At It"

    www.dessoft.co.za

  5. #5

    Thread Starter
    Junior Member Righteous_trespasser's Avatar
    Join Date
    Feb 2007
    Location
    Pretoria, South-Africa
    Posts
    31

    Re: [2005] Gridview Datasource

    but to change the query realtime ... (while the page is open) ... so if a user clicks on a button it changes the query and refreshes the grid ...
    Last edited by Righteous_trespasser; Sep 7th, 2007 at 07:14 AM. Reason: typo ... change the word "raltime" to "realtime"
    Righteous_Trespasser
    "Be Good, And If You're Not, Be Good At It"

    www.dessoft.co.za

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Gridview Datasource

    While this isn't a proper solution to your question, what happens when you attempt to create a regular dataset and bind the gridview to that dataset?

  7. #7

    Thread Starter
    Junior Member Righteous_trespasser's Avatar
    Join Date
    Feb 2007
    Location
    Pretoria, South-Africa
    Posts
    31

    Re: [2005] Gridview Datasource

    I have found another way ... Each time another option is taken, instead of trying to bind another datasource to it, I just change the Select Query and then DataBind it again ... because they all come from the same database, they just have different queries ...
    Righteous_Trespasser
    "Be Good, And If You're Not, Be Good At It"

    www.dessoft.co.za

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width