Register   Login
     
  Latest Posts  
RE: Recently created articles are not shown in list
by atriage on 3/20/2010 10:15 AM
RE: Recently created articles are not shown in list
by spirit on 3/20/2010 10:08 AM
RE: Introducing the most powerful News Slider for Ventrian News Articles
by jhoelz on 3/19/2010 9:29 PM
Rich Snippets for Review, Ratings etc!
by georgelew on 3/19/2010 7:49 PM
Recently created articles are not shown in list
by atriage on 3/19/2010 11:18 AM
RE: News Articles Tokens
by spirit on 3/19/2010 10:43 AM
Author post count and link in listing.item.html
by mattbunce on 3/19/2010 10:18 AM
RE: News Article Detail and Lightbox
by spirit on 3/19/2010 10:12 AM
RE: News Article Detail and Lightbox
by ray-isc on 3/19/2010 9:49 AM
Using custom profile properties with [AUTHOR:XXX]
by mattbunce on 3/19/2010 9:34 AM
  Forums  
Subject: Programming Question about Gridview
Prev Next
You are not authorized to post a reply.

Author Messages
omorganUser is Offline
Gold Membership
Ventrian Active Member
Ventrian Active Member
Posts:27

5/26/2009 12:26 PM  

I'm not sure how best to explain this but please bear with me.

I have a datasource being pulled in to a gridview from an xml file.

I have paging setup on this with the ability to select a row in the gridview and once selected it should populate text boxes with the information from the dataset/xml.

However my problem is that when I select a row, it only selects from the first page of the gridview. So I could be on page 5, and no matter which one I select on page 5 it will pull the data up from the first few pages.

There is the basics of my code that is doing that.

On the SelectedIndexChanged event.

txtCompany.Text = ds.Tables("BiddersList").Rows(GridView1.SelectedIndex).Item("Company_Name")

So if I'm on page 5, or whatever, it is still reading the selected row as maybe 1 or 2, and pulling that in from the dataset, instead of pulling in row 10.

Can anyone give me a hand with this I'm getting myself confused and probably not relaying it properly.

Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


5/27/2009 6:27 AM  
You want to change this part:-

GridView1.SelectedIndex

It should be whatever page you are on minus 1 * page size + gridview1.selectedindex


Scott McCulloch
Site Administrator
omorganUser is Offline
Gold Membership
Ventrian Active Member
Ventrian Active Member
Posts:27

5/28/2009 6:02 AM  

Thanks Scott! That works perfectly.

I might have a few more questions if you don't mind.

omorganUser is Offline
Gold Membership
Ventrian Active Member
Ventrian Active Member
Posts:27

5/28/2009 7:19 AM  
Ok, so I have a couple of more questions.

I'm doing a dataview sort on my tables. Merging that into a Dataset, and displaying the dataset. The filter works perfectly, however when I click to go to the next page, it resets my dataset back to it's original and gets rid of the filter. (Now that I type this it is probably a code/logic thing, but thought I'd ask)

Also, I have two datasets, each has identical columns but not the same number of rows. I need to merge these two, but delete/remove duplicate entries. Do you have any suggestion on how to do that?
Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


5/28/2009 7:23 AM  
For the merge, you need to write custom code to do this, shouldn't be too hard if they have primary keys.

For the sort, it's difficult to say, but I would say your filter isn't being saved properly.

Scott McCulloch
Site Administrator
omorganUser is Offline
Gold Membership
Ventrian Active Member
Ventrian Active Member
Posts:27

5/28/2009 8:00 AM  
Yea it looks like my filter is getting reset due to the pageload event and can't figure out how to get around it. When the page loads, it loast a sorted dataview, then I have a text box that people search on, and that creates a new dataview, which I save to a dataset. But when I click to page on the gridview it resets back to the original dataview because of the page load.

As for the merge, that's what i was thinking but can't quite figure out the code hah. So I wasn't sure if you had an example or not.

I'm thinking this project might be a bit too hard for me ha and end up telling the department to purchase something, but I hate to give up on it.
You are not authorized to post a reply.
Forums > General > DotNetNuke Questions > Programming Question about Gridview



ActiveForums 3.7