GridView FormView not in sync

Q

Q. John Chen

I have a GridView and a FormView serve as master/detail relation.
The GridView has paging enabled - 10 rows/page.

The formView is linked to gridView's SelectedValue as the sole
parameter.

All works well, for example:

1. Select the first row in GridView; The FormView shows the detail
correspond to the first record.
2. Select another page, the same row (number) is automatically
selected; The formView shows the correct info.

BUT, there is one exception:
1. Select the last row in first page; The FormView is good.
2. Select the last PAGE (which only has 5 rows); No row is selected and
FormView shows nothing.
3. I then select the previous page. The last row IS SELECTED in
GridView. BUT FormView SHOWS NOTHING.

I tried to look at the values in the code (PageIndexChanged Event). The
SelectValue of the gridview is not even set yet (null) and the
SelectedIndex is always 9 (the last row).

Any explaination? How can I fix this? All I care is master and detail
are in sync. I also tried to just simple change the SelectedIndex to
the lastRow if totol rows are less than 10 but what property can be
used to determine this?

Thanks

John
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top