|
-
Sep 6th, 2007, 09:57 AM
#1
Thread Starter
Junior Member
[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 ...
-
Sep 6th, 2007, 02:48 PM
#2
Hyperactive Member
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
-
Sep 6th, 2007, 03:13 PM
#3
Thread Starter
Junior Member
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 ...
-
Sep 7th, 2007, 07:12 AM
#4
Thread Starter
Junior Member
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?
-
Sep 7th, 2007, 07:13 AM
#5
Thread Starter
Junior Member
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"
-
Sep 8th, 2007, 10:47 AM
#6
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?
-
Sep 9th, 2007, 06:28 AM
#7
Thread Starter
Junior Member
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 ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|