Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid view and details view problems 1

Status
Not open for further replies.

hughejars

Technical User
Mar 14, 2007
91
GB
Hi
Can someone please rap their head around this one, it's totally stumped me.
I have a SQL server database all set up.
I use a grid view to view the all the data, and have paging enabled obviously because theres a lot of information.
I then have a details view set up so which ever item you SELECT from the gridview the details are placed in the details view. That all works great.....

Until you press the next page button, and then press the SELECT button for an item on the next page or any further pages. The details view box only shows the details of the first 5 items on the first page i.e. if i select item 7, it shows the details of item 2.

If I disable paging and show the entire database in one very looooong grid view, it works fine which ever item i select.

Cheers, and thanks in advance for any help or thoughts
Phil

Phil

- nothing there yet so give me a few weeks to get something together. This ASP.NET looks like fun.
 
You are probably selecting the row by index, instead of a unique ID, as Mark has sugggested.
 
hmmm!!

Well that was not easy but it seems I had the following enetered
"DetailsView1.PageIndex = GridView1.SelectedIndex"
Which is great for non paged Grid Views
what seems to work though is
"DetailsView1.PageIndex = GridView1.SelectedIndex + GridView1.PageSize * GridView1.PageIndex"

I'll keep a note of that one I think.

Cheers
Phil


- nothing there yet so give me a few weeks to get something together. This ASP.NET looks like fun.
 
Nice work Hughejars, I had this exact issue...this is the only post I could find on the web for this, which is strange as I can imagine it's a fairly normal implementation of standard .NET controls...

Oh well, cheers!

Bob

lastdonuk
Powergirls Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top