Hii all,
In one my child page i've an updatepanel which contains a gridview .The gridview displays huge amt of data (~3 pages of data) and the updatepanel refreshes for every 1 sec,for tht i've used timer control, to get the updated data from the server.for that i've used one timer.
The problem is ,the webpages scroll bar(both horizontal and vertical) is repositioning to the starting position after every refresh. -
<asp:Timer ID="TimerSystem" runat="server" OnTick="OnTick_TimerSystem" Interval="2000">
-
</asp:Timer>
-
<asp:UpdatePanel ID="UpnlSystem" runat="server" UpdateMode="Conditional">
-
<triggers>
-
<asp:AsyncPostBackTrigger ControlID="TimerSystem" EventName="Tick" />
-
</triggers>
-
<contenttemplate>
-
<asp:GridView ID="GridViewSystem" runat="server" CellPadding="4DataSourceID="SystemCounterOds">
-
-
</asp:GridView>
-
-
</contenttemplate>
-
</asp:UpdatePanel>
-
This is what the code ...
Can anybody kindly tell me why this scrollbar refreshing is happening .
Thanks in advance..
Rgds,
BTR.
18 24775 Frinavale 9,735
Recognized Expert Moderator Expert
I don't think there's anything out there that will fix this problem.
You could create an Ajax Enabled Server Control that inherits from the ASP.NET Panel class which has a style of overflow:scroll and tracks the scroll position between postbacks.
If you're interested I could give you a hand with this.
It's fun :)
Thanks for the reply Frinavale.
How are you n how are you doing?
Hey please tell me how to do that one ,coz in almost 3 forms im facing the same problem ..
Requesting you kindly give me the solution or guide me in this regards.
Thanks in advance..
Rgds,
BTR.
Hey i found one reference link while seraching on the net . below is the link .. http://basgun.wordpress.com/2008/06/...anel-postback/
i tried this one but it did work for me...but in the same manner if we're able to find the reference to the browser window..so that the scroll positions of the browser window....and after tht we can follw the same approach mentioned in the article at above link.
what do you say Frinavale... will this works for us or not.OR is thr any better approach .
Thank you ,
Rgds,
BTR.
-
<script type="text/javascript">
-
var xPos,yPos;
-
var prm=Sys.WebForms.PageRequestManager.getInstance();
-
-
prm.add_beginRequest(BeginRequest);
-
prm.add_endRequest(EndRequest);
-
-
function BeginRequest(sender,args)
-
{
-
xPos=document.body.scrollLeft;
-
yPos=document.body.scrollTop;
-
}
-
function EndRequest(sender,args)
-
{
-
document.body.scrollLeft=xPos;
-
document.body.scrollTop=yPos;
-
}
-
-
</script>
-
-
Hey im using this code to get the scroll positions of the browser window .
But this is not working for me ,some where it went wrong..
Can anybody telle me, Is there any other way to get the scroll positions of the browser window in Javascript.
Thank you...
BTR.
Frinavale 9,735
Recognized Expert Moderator Expert
This isn't exactly what I was talking about but you're on the right track. You need to get the scroll position of the Panel element that your content is within, not the scroll position of the document.body element.
You should use something like the following (please see comments for an explanation of what I'm doing and why): -
<script type="text/javascript">
-
var xPos,yPos;
-
var prm=Sys.WebForms.PageRequestManager.getInstance();
-
-
prm.add_beginRequest(BeginRequest);
-
prm.add_endRequest(EndRequest);
-
-
function BeginRequest(sender,args)
-
{
-
//You need to grab a reference to the Panel client side
-
//in this function.
-
//The ID of the Panel in the browser is made available
-
//to you in ASP.NET through the Panel's ClientID property.
-
//So, you need to use Response.Write to write the
-
//ClientID of the Panel into the JavaScript Function.
-
-
//A short hand, ASP call to the Response.Write
-
//method is <%= %>
-
-
//To get a reference to the Panel client side you can use
-
//the JavaScript method: document.getElementByID:
-
//For example:
-
//var contentPanel = document.getElementID("<%=myPanel.ClientID %>");
-
-
//The .NET Ajax framework has made this a little easier by
-
//providing a $get() method.
-
-
var contentPanel = $get("<%=myPanel.ClientID %>");
-
xPos=contentPanel.scrollLeft;
-
yPos=contentPanel.scrollTop;
-
}
-
function EndRequest(sender,args)
-
{
-
//Same thing here, you need to set the Panel's scroll:
-
var contentPanel = $get("<%=myPanel.ClientID %>");
-
contentPanel.scrollLeft=xPos;
-
contentPanel.scrollTop=yPos;
-
}
-
-
</script>
Hiii ,
I tried this one here ..its working fine....but one kind of jerk is coming in the position of scrollbar...whi ch is not suppose to come and irritating .
Below is the code -
script type="text/javascript">
-
var xPos1,yPos1;
-
var prm=Sys.WebForms.PageRequestManager.getInstance();
-
prm.add_pageLoaded(pageLoaded);
-
prm.add_pageLoading(pageLoadingHandler);
-
function pageLoaded(sender,args)
-
{
-
//window.scrollTo(xPos1,yPos1);
-
document.documentElement.scrollLeft=xPos1;
-
document.documentElement.scrollTop=yPos1;
-
}
-
function pageLoadingHandler(sender,args)
-
{
-
xPos1=document.documentElement.scrollLeft;
-
yPos1=document.documentElement.scrollTop;
-
}
-
</script>
-
Frinavale 9,735
Recognized Expert Moderator Expert
Hmmm, have you considered fading out the content and displaying a message like "processing " or something while the page is updating?
Then when it comes back, fade it back in?
I didn't realize you were scrolling the whole page, I thought it was just a section of it.
Does it really jerk?
Or do the scroll bars just reposition?
(that's what my panel does sometimes...not in every browser)
Hey hii Frinavale,
I changed the code and did whatever you were telling .....like i placed the update panel which contains a gridview in one of the panel .
Now instead of tracking the scrollbar positions of the browser i'm getting the scrollbar positions of the panel and its working fine..but with one small problem.
The verticle scrollbar is going to the zero position and coming back to the prev position where it was before refresh .. and surprisingly this is not happening with the horizontal one...:).Below is the code part. -
var xPos1,yPos1;
-
-
var prm=Sys.WebForms.PageRequestManager.getInstance();
-
prm.add_pageLoading(pageLoadingHandler);
-
prm.add_pageLoaded(pageLoaded);
-
function pageLoaded(sender,args)
-
{
-
-
$get('<%=contentPanel.ClientID %>').scrollLeft=xPos1;
-
$get('<%=contentPanel.ClientID %>').scrollTop=yPos1;
-
}
-
function pageLoadingHandler(sender,args)
-
{
-
xPos1=$get('<%=contentPanel.ClientID %>').scrollLeft
-
yPos1=$get('<%=contentPanel.ClientID %>').scrollTop;
-
}
-
-
who is telling to this vertical scrollbar to go back to zero position and come back.?
Rgds,
BTR.
Frinavale 9,735
Recognized Expert Moderator Expert
I haven't actually done the vertical scroll position so I was unaware that the scroll is noticeable.
What's happening is that portion of the page is being sent to the server.
When that portion is sent back to the browser it is rendered with the top of the content being at the top of the panel....your JavaScript scrolls the content so that it is at the same position as before.
I'm not sure how to get around this.
That "updating" message I suggested earlier might be a good idea. It could hide the content until it's finished loading and repositioned.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Colin McGuire |
last post by:
Hello experts, this is a repost but I have been (much) more clear.
I want to know the position of the horizontal scrollbar in a textbox
as a percentage
- if the horizontal scrollbar is hard left,
I want to display 0% on the form.
- if the horizontal scrollbar is smack in the middle,
I want to display 50% on the form.
- if the horizontal...
|
by: brett |
last post by:
I have an AJAX updatepanel in an aspx page. Inside the updatepanel is
a placeholder control, which loads various ascx files. This all works
fine. One of the ascx files also has an updatepanel in it. In the
updatepanel is an ASP.NET image button that does a postback. So, it
looks like this:
aspx.updatepanel.Add(LoadControl(ascx...
|
by: Reinhard |
last post by:
Hi,
Need some directions on Ajax, UpdatePanel and Gridview to achive the
following:
I like to show a Gridview with Data ONLY if the user is interested in
Details, but without a full page reload!
If the page loads, only a summary (eg. COUNT of recs) should be
displayed
|
by: John Grandy |
last post by:
Is anyone finding that cookies added to the Response.Cookies collection
within pages which contain an UpdatePanel do not exist in the
Request.Cookies collection when the page is posted back ?
These should be complete page postbacks not partial postbacks, because the
postback in question is not triggerred by a control inside the UpdatePanel...
|
by: abellix |
last post by:
An updatepanel contains a datagrid, this datagrid has columns generated by code-behind: some columns should have async postback, others should have sync postback.
Here a sample to reproduce the behaviour: it's a webform with some VB code-behind, you shoud create a new AJAX-enabled application and past the following code.
(DEFAULT.ASPX)
...
| |
by: =?Utf-8?B?T2xlZw==?= |
last post by:
Hi,
I'm wondering if anybody using ajax extensions where UpdatePanel tag is used
in addition to existing ajax implementation where UpdatePanel wasn't used yet.
So, there is already a web project where ajax is used, but not with
UpdatePanel. (without extensions) Would I be able to use UpdatePanel tag
along with the current implementation? Or...
|
by: GaryDean |
last post by:
Is there any way to make an asp FileUpload control work within an
UpdatePanel?
Thanks,
Garyh
|
by: SAL |
last post by:
Hello,
I'm trying to include a popup in the ItemTemplate of a gridview row. The
ItemTemplate for the field contains a textbox and when the user clicks in
the textbox I want a popup panel to show allowing the user to make a
selection from the popup window. I have enabled AJAX extensions and have a
working sample outside of a gridview. However,...
|
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= |
last post by:
Hello,
On a webpage, create an UpdatePanel with two DropDownLists.
Set AutoPostBack of DropDownList1 to true.
In the SelectedIndexChanged method, refill DropDownList2 and set the focus
to DropDownList1 using the ScriptManager SetFocus method.
Use the Visual Studio debugger.
Set a breakpoint on in the (!IsPostBack) part of the PageLoad...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |