473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Panel scroll position reset on postback

I have added Panel control to a web page which contains a GridView. The
Panel's ScrollBars property is set to auto. When I select the Select
CommanField button for a row (which obviously causes a postback), the scroll
position resets to the top.

I was unable to figure out how to not force a postback or how to reset the
scroll position of the GridView.

What are my options here?

Thanks,
Ryan
Nov 19 '05 #1
3 6059
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/de...ationTopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"rmunson8" <rm******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I have added Panel control to a web page which contains a GridView. The
Panel's ScrollBars property is set to auto. When I select the Select
CommanField button for a row (which obviously causes a postback), the
scroll
position resets to the top.

I was unable to figure out how to not force a postback or how to reset the
scroll position of the GridView.

What are my options here?

Thanks,
Ryan

Nov 19 '05 #2
I have tried that and it doesn't work. I am not sure if that setting applies
to a scroll within a panel.

"Steve C. Orr [MVP, MCSD]" wrote:
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/de...ationTopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"rmunson8" <rm******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I have added Panel control to a web page which contains a GridView. The
Panel's ScrollBars property is set to auto. When I select the Select
CommanField button for a row (which obviously causes a postback), the
scroll
position resets to the top.

I was unable to figure out how to not force a postback or how to reset the
scroll position of the GridView.

What are my options here?

Thanks,
Ryan


Nov 19 '05 #3
This can be done, but is not too straight forward, you need to know which
row was clicked and then a bit of Java script as well.

In the Code Behind, declare a variable to hold the row ID, something like:
Protected m_SelectedRowId As String = ""

After you did the DataBind() on the grid, each row must get an ID:
DataGrid1.DataBind()
Dim oneItem As DataGridItem, rowCtr As Integer
For Each oneItem In DataGrid1.Items
oneItem.ID = "Row_" & rowCtr
rowCtr += 1
Next

In the Code Behind you need the ID of the row clicked, use the ItemCommand
handler:
Private Sub DataGrid1_ItemCommand(yada yada ...)
m_SelectedRowId = e.Item.ClientID
.....
End Sub

Now in the Java Script the row must be scrolled into view.
Go into HTML design view of the form and paste this right at the bottom of
the page, below everything else
<script language=javascript>
<!--
var theRowId = '<%=m_SelectedRowId%>';
if (theRowId != "") {
document.getElementById(theRowId).scrollIntoView() ;
}
//-->
</script>

I've copied and pasted everything from one of my pages where it is used,
should work.
"rmunson8" <rm******@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I have added Panel control to a web page which contains a GridView. The
Panel's ScrollBars property is set to auto. When I select the Select
CommanField button for a row (which obviously causes a postback), the
scroll
position resets to the top.

I was unable to figure out how to not force a postback or how to reset the
scroll position of the GridView.

What are my options here?

Thanks,
Ryan

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ed | last post by:
Does anyone know if ASP.NET 2.0 is going to incorporate "maintain scroll position on postback" in non-IE browsers like Firefox? This seems like an often requested feature on these newsgroups...
2
by: kevin | last post by:
hi, all it seems that smartnavigation has problem with the hide/show panel in the aspx page, I have three panel wih back/next buttons, the first two page works fine, but at the last page,...
5
by: JezB | last post by:
There are a few references on the net about how to restore a page's scroll position over a postback. This is a simple one which works for me: eg....
0
by: Chris Rathman | last post by:
Setting MaintainScrollPositionOnPostBack=true gets me the behavior I most often want, but there are times when I need to have the scroll position return to the top of the page - instead of the last...
2
by: Paul E Collins | last post by:
I'm writing an application whose main window consists of a particular UserControl that I have placed inside a docked Panel so that it will fill the whole window. The panel also has the AutoScroll...
5
by: RobertK | last post by:
I have a table that displays one row of images (thumbnails). When a user clicks on an image it opens up a bigger image below it. The row has about 20 cells. I have a <divtag which allows the user...
7
by: Lit | last post by:
Hi, How can I capture the vertical scroll bar position for a Listbox. I have a Listbox of 100 items + when I click on it I post back remove the item selected. After returning to the client...
2
by: kulabhishek | last post by:
Hello all. I have developed one user control "Grid" in C# and I am using it in another user control inside one panel. The AutoScroll property for the panel is enabled. When the height or...
12
Frinavale
by: Frinavale | last post by:
I think I'm trying to do something impossible. I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.