Home All Groups Group Topic Archive Search About

Scroll position in panel control

Author
26 Mar 2006 6:46 PM
Jason James
Hi all,

I've checked the posts but this question doesn't
seem to have been asked in a while and I don't
seem to be able to find an answer for it anywhere
else.

I have a panel control on my page that contains
a datalist.  The datalist renders small thumbnails
(200px X 200px) for up to 200 images.  When
I click the image a itemSeleted event is
fired, and a postback to the server renders
a large copy of the image in an image control
on the form.  Unfortunately, due to the postback
the panel control return to the top of its scroll
position where I might not be able to see the
thumbnail that I just selected.

Does anyone know if I can maintain the scroll
position of the panel control, just as I can
with the form as a whole using the Page
directive MaintainScrollPositionOnPostback?

Can I get the scroll value of the panel control,
or should I really look at javascript to load the
image from the thumbnail and avoid the
postback altogether?

Any thoughs would be most welcome.

Regards,

Jason.



*** Sent via Developersdex http://www.developersdex.com ***

Author
26 Mar 2006 9:00 PM
Steve C. Orr [MVP, MCSD]
In ASP.NET 1.x, if you enable SmartNavigation on the page, it should be able
to retain the scroll position after postback.

Here's more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassSmartNavigationTopic.asp

If you're using ASP.NET 2.0, there is a (usually) better alternative:
Page.MaintainScrollPositionOnPostBack = True

Here's more info:
http://msdn2.microsoft.com/en-us/library/system.web.ui.page.maintainscrollpositiononpostback.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net




Show quoteHide quote
"Jason James" <jason.mapson@dive--master_nospam.org> wrote in message
news:eDv3WWQUGHA.5468@TK2MSFTNGP14.phx.gbl...
> Hi all,
>
> I've checked the posts but this question doesn't
> seem to have been asked in a while and I don't
> seem to be able to find an answer for it anywhere
> else.
>
> I have a panel control on my page that contains
> a datalist.  The datalist renders small thumbnails
> (200px X 200px) for up to 200 images.  When
> I click the image a itemSeleted event is
> fired, and a postback to the server renders
> a large copy of the image in an image control
> on the form.  Unfortunately, due to the postback
> the panel control return to the top of its scroll
> position where I might not be able to see the
> thumbnail that I just selected.
>
> Does anyone know if I can maintain the scroll
> position of the panel control, just as I can
> with the form as a whole using the Page
> directive MaintainScrollPositionOnPostback?
>
> Can I get the scroll value of the panel control,
> or should I really look at javascript to load the
> image from the thumbnail and avoid the
> postback altogether?
>
> Any thoughs would be most welcome.
>
> Regards,
>
> Jason.
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***