Hi.
I have so many controls in my pages.i want to maintain focus on current control.
I tried the property "maintain scroll position on postback" of the page .
But its not working.
Please reply...
Thanks in advance
Deepthi
Loading

Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 3, 2010, 10:07 PM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true" %>
or
Page.MaintainScrollPositionOnPostBack = true;
Rakesh Jha85 reputationPosted Oct 3, 2010, 9:59 PM EDT
SmartNavigation = true;
Deepthi Aravind53 reputationPosted Oct 4, 2010, 2:32 AM EDT
Its not working in mozilla and Chrome but its fine in IE.
Any tips for solving the above problem??
Regards
Deepthi
Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 4, 2010, 3:29 AM EDT
Deepthi Aravind53 reputationPosted Oct 4, 2010, 3:49 AM EDT
First i tried that way...Its not working
Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 4, 2010, 3:51 AM EDT
Deepthi Aravind53 reputationPosted Oct 4, 2010, 3:57 AM EDT
Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 4, 2010, 4:10 AM EDT
formID].xCoordHolder.value = scrollX; document.forms[formID].yCoordHolder.value = scrollY; } function sstchur_SmartScroller_Scroll() { var x = document.forms[formID].xCoordHolder.value; var y = document.formsformID].yCoordHolder.value; window.scrollTo(x, y); } window.onload = sstchur_SmartScroller_Scroll; window.onscroll = sstchur_SmartScroller_GetCoords; window.onkeypress = sstchur_SmartScroller_GetCoords; window.onclick = sstchur_SmartScroller_GetCoords; // -->Rakesh Jha85 reputationPosted Oct 4, 2010, 4:11 AM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true"%>
now after that put below code in code behind file
protected void Page_Load(object sender, EventArgs e)
{
SmartNavigation = true;
}
now create a default folder of App_Browsers in root directory and add new item, select browser.browser file and set its name like SafariFix.browser and put replace below code
<browsers>
<browser id="NewBrowser" parentID="Mozilla">
<identification>
<userAgent match="Unique User Agent Regular Expression" />
identification>
<capture>
<userAgent match="NewBrowser (?'version'\d+\.\d+)" />
capture>
<capabilities>
<capability name="browser" value="My New Browser" />
<capability name="version" value="${version}" />
capabilities>
browser>
<browser refID="Safari1Plus">
<capabilities>
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
capabilities>
browser>
browsers>
it will completely solve your problem, because i already tested in all three browsers
Suthish NairRank #92 · 22.8K reputationPosted Oct 4, 2010, 4:11 AM EDT
http://www.c-sharpcorner.com/UploadFile/Blogs/3440/
Suthish NairRank #92 · 22.8K reputationPosted Oct 4, 2010, 4:32 AM EDT
I still remember, the first time when you load the page everything works fine. But after couple of postbacks its starts throwing js error or web form not loading.
from msdn:
http://msdn.microsoft.com/en-us/library/system.web.ui.page.smartnavigation.aspx
In most circumstances, do not set this property in code. Set the SmartNavigation attribute to true in the @ Page directive in the .aspx file. When the page is requested, the dynamically generated class sets this property.
Deepthi Aravind53 reputationPosted Oct 4, 2010, 9:11 PM EDT
I have added the two properties ,MaintainScrollPositionOnPostback="true" and Smartnavigation="true" in web.config.
And also created browser file .But its not working.
Whether i have to mention those properties in all pages?
Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 4, 2010, 9:23 PM EDT
Rakesh Jha85 reputationPosted Oct 4, 2010, 9:53 PM EDT
Deepthi Aravind53 reputationPosted Oct 4, 2010, 10:02 PM EDT
thats y i m added those lines to web.config.
Suthish NairRank #92 · 22.8K reputationPosted Oct 4, 2010, 10:16 PM EDT
Are you using Ajax on your web page.?
Did you tried the link i posted?
How can it possible none of the solution given here not working?
Are you getting any javascript error, below left corner of your IE?
Rakesh Jha85 reputationPosted Oct 4, 2010, 10:19 PM EDT
you don't have to upload your whole project only provide 2 or 3 pages and rest required files & folders