List Info

Thread: Related to SmartNavigation (ASP.NET 2.0)...




Related to SmartNavigation (ASP.NET 2.0)...
user name
2006-12-25 18:17:38
Hi,
     As we know that on every post back the browser loses the scrollbar position of the page. So the solution for it is to use the SmartNavigation attribute of  Page. Eg.,
 
<% Page Language="C#" SmartNavigation="true" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
The SmartNavigation=”true” will retain the position of the scroll bar of the page on every postback. I tried with a simple code as below
 
<body>
 &nbsp;  <form id="form1" runat="server"&gt;
 &nbsp;  <div runat="server" id="Div1">;
 &nbsp;  <table>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox1" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox2" runat="server"&gt;</asp:TextBox>
 &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox3" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp;  .
.
.
.
.
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox35" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp; 
 &nbsp;  </table>
 &nbsp;  </div>
 &nbsp;  <div>
 &nbsp; &nbsp; &nbsp;  <asp:Button ID="Button1" runat="server" Text="Button" />
 &nbsp;  </div>
 &nbsp;  </form>
</body>
 
In the above code, I have used about 35 textboxes in one DIV tag, this will produce the scrollbar on the page. Now, make SmartNavigation=”true” for the Page. Run It. Now, Scroll to the bottom most position of the page, enter your name in last textbox and click the Botton. The page will be posted back and you will find that the position of the scrollbar is retained (at the bottom).
If you remove SmartNavigation=”true” from the Page Directive, the scrollbar position will not be retained.
Now, do a small change with the above code.
 
Just replace  <div runat="server" id="Div1">;
With “<div runat="server" id="Div1" style="height:500px; overflow:auto;">
 
The above replaced line will set the Height of the Div tag to 500px and Overflow:auto will provide scrollbar to the Div tag. Now again Run it.
Perform the same action, scroll down to the bottom most position, enter your name in the last textbox and click the button. The page will be posted back but now the position of the scrollbar is not retained.
 
This exactly is my requirement:
How to retain the scrollbar position of the Div tag scrollbar?
 
Regards
Tajinder

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com __._,_.___ __,_._,___

Related to SmartNavigation (ASP.NET 2.0)...
user name
2006-12-29 05:31:03
Hi teju,
 
 
 &nbsp;  This is Iyyappan I will try to solve your req.Bye.

teju pyaara <teju_pyaarayahoo.com&gt; wrote:
Hi,
 &nbsp; &nbsp; As we know that on every post back the browser loses the scrollbar position of the page. So the solution for it is to use the SmartNavigation attribute of  Page. Eg.,
<% Page Language="C#" SmartNavigation="true" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
The SmartNavigation=”true” will retain the position of the scroll bar of the page on every postback. I tried with a simple code as below
<body>
 &nbsp;  <form id="form1" runat="server"&gt;
 &nbsp;  <div runat="server" id="Div1">;
 &nbsp;  <table>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; <td>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; <asp:TextBox ID="TextBox1" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; <td>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; <asp:TextBox ID="TextBox2" runat="server"&gt;</asp:TextBox>
 &nbsp;  &nbsp; &nbsp;   ; &nbsp;</td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; <td>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; <asp:TextBox ID="TextBox3" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp;  .
.
.
.
.
 &nbsp; &nbsp; &nbsp;  <tr>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; <td>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; <asp:TextBox ID="TextBox35" runat="server"&gt;</asp:TextBox>
 &nbsp; &nbsp; &nbsp;   ; &nbsp; </td>
 &nbsp; &nbsp; &nbsp;  </tr>
 &nbsp; &nbsp; &nbsp; 
 &nbsp;  </table>
 &nbsp;  </div>
 &nbsp;  <div>
 &nbsp; &nbsp; &nbsp;  <asp:Button ID="Button1" runat="server" Text="Button" />
 &nbsp;  </div>
 &nbsp;  </form>
</body>
In the above code, I have used about 35 textboxes in one DIV tag, this will produce the scrollbar on the page. Now, make SmartNavigation=”true” for the Page. Run It. Now, Scroll to the bottom most position of the page, enter your name in last textbox and click the Botton. The page will be posted back and you will find that the position of the scrollbar is retained (at the bottom).
If you remove SmartNavigation=”true” from the Page Directive, the scrollbar position will not be retained.
Now, do a small change with the above code.
Just replace&nbsp; <div runat="server" id="Div1">;
With “<div runat="server" id="Div1" style="height:500px; overflow:auto;">
The above replaced line will set the Height of the Div tag to 500px and Overflow:auto will provide scrollbar to the Div tag. Now again Run it.
Perform the same action, scroll down to the bottom most position, enter your name in the last textbox and click the button. The page will be posted back but now the position of the scrollbar is not retained.
This exactly is my requirement:
How to retain the scrollbar position of the Div tag scrollbar?
 
Regards
Tajinder
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Iyyappan.A
Software Engineer,
K+ Office Solutions,
Coimbatore.
09894573073

2;__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com __._,_.___ __,_._,___

Related to SmartNavigation (ASP.NET 2.0)...
user name
2006-12-29 07:29:55

Hi Tejinder,

 

Try the following piece of code in the <BODY&gt; tag of your aspx page, with Smart Navigation turned OFF.

 

<BODY  onscroll=javascript:setcoords() bottomMargin=0 leftMargin=0 topMargin=0 onload=javascript:ScrollIt() rightMargin=0>

<SCRIPT language=javascript&gt;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  function ScrollIt()

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  {

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; window.scrollTo(document.Form1.PageX.value, document.Form1.PageY.value);

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  }

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  function setcoords()

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  {

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; var myPageX;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; var myPageY;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; if (document.all)

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; {

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  myPageX = document.body.scrollLeft;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  myPageY = document.body.scrollTop;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; }

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; else

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; {

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  myPageX = window.pageXOffset;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  myPageY = window.pageYOffset;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; }

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; document.Form1.PageX.value = myPageX;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; document.Form1.PageY.value = myPageY;

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  }

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  </ SCRIPT>

 

Check and let me know if this resolves your issue, or else we can try something else.

 

Regards,

Deepali

 

-----Original Message-----
From: certifyDotNetWithCSharp@yahoogroups.com [mailto:certifyDotNetWithCSharp@yahoogroups.com] On Behalf Of teju pyaara
Sent: Monday, December 25, 2006 11:48 PM
To: dotnet_mcad@yahoogroups.com; dotnetcertification@yahoogroups.com; dotnetsycho@yahoogroups.com; gurgaon-jobs@yahoogroups.com; gurgaon_it_software_job@yahoogroups.com; itjobsnoida@yahoogroups.com; jobahead@yahoogroups.com; jobsdhundo@yahoogroups.com; la-dot-net-group@yahoogroups.com; m_c_p@yahoogroups.com; maidenhead-dot-net@yahoogroups.com; mcad-mcsd@yahoogroups.com; mcad_70_315@yahoogroups.com; mcad_ceylon@yahoogroups.com; allcerttrainingclub@yahoogroups.com; asp_developers@yahoogroups.com; aspnetunleashed@yahoogroups.com; boson_mcsd@yahoogroups.com; certifydotnetwithcsharp@yahoogroups.com; delhi_it_walkin@yahoogroups.com; tajinder dogra; tajinder dogra; tajinder dogra; dot-net-jobs@yahoogroups.com; dot_net_community@yahoogroups.com; dot_net_queries@yahoogroups.com; dot_net_world@yahoogroups.com; dotnet-jobs-india@yahoogroups.com; dotnet4u@yahoogroups.com
Subject: [certifyDotNetWithCSharp] Related to SmartNavigation (ASP.NET 2.0)...

 

Hi,

 &nbsp; &nbsp; As we know that on every post back the browser loses the scrollbar position of the page. So the solution for it is to use the SmartNavigation attribute of  Page. Eg.,

 

<% Page Language="C#&quot; SmartNavigation="true" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"; %>

 

The SmartNavigation=̶1;trueR21; will retain the position of the scroll bar of the page on every postback. I tried with a simple code as below

 

<body>

 &nbsp;  <form id="form1" runat="server"&gt;

 &nbsp;  <div runat="server" id="Div1">;

 &nbsp;  <table>

 &nbsp; &nbsp; &nbsp;  <tr>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox1" runat="server"&gt;</asp:TextBox>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>

 &nbsp; &nbsp; &nbsp;  </tr>

 &nbsp; &nbsp; &nbsp;  <tr>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox2" runat="server"&gt;</asp:TextBox>

 &nbsp;  &nbsp; &nbsp;   ; &nbsp;</td>

 &nbsp; &nbsp; &nbsp;  </tr>

 &nbsp; &nbsp; &nbsp;  <tr>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox3" runat="server"&gt;</asp:TextBox>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>

 &nbsp; &nbsp; &nbsp;  </tr>

 &nbsp; &nbsp; &nbsp;    ; &nbsp;  .

.

.

.

.

 &nbsp; &nbsp; &nbsp;  <tr>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; <td>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; <asp:TextBox ID="TextBox35"; runat="server"&gt;</asp:TextBox>

 &nbsp; &nbsp; &nbsp; &nbsp;   ; </td>

 &nbsp; &nbsp; &nbsp;  </tr>

 &nbsp; &nbsp; &nbsp; 

 &nbsp;  </table>

 &nbsp;  </div>

 &nbsp;  <div>

 &nbsp; &nbsp; &nbsp;  <asp:Button ID="Button1" runat="server" Text="Button" />

 &nbsp;  </div>

 &nbsp;  </form>

</body>

 

In the above code, I have used about 35 textboxes in one DIV tag, this will produce the scrollbar on the page. Now, make SmartNavigation=̶1;trueR21; for the Page. Run It. Now, Scroll to the bottom most position of the page, enter your name in last textbox and click the Botton. The page will be posted back and you will find that the position of the scrollbar is retained (at the bottom).

If you remove SmartNavigation=̶1;trueR21; from the Page Directive, the scrollbar position will not be retained.

Now, do a small change with the above code.

 

Just replace&nbsp; “<div runat="server" id="Div1">

With “<;div runat="server" id="Div1" style="height:500px; overflow:auto;">221;

 

The above replaced line will set the Height of the Div tag to 500px and Overflow:auto will provide scrollbar to the Div tag. Now again Run it.

Perform the same action, scroll down to the bottom most position, enter your name in the last textbox and click the button. The page will be posted back but now the position of the scrollbar is not retained.

 

This exactly is my requirement:

How to retain the scrollbar position of the Div tag scrollbar?

 

Regards

Tajinder

 __________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__._,_.___ __,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )