Export (0) Print
Expand All

Page.SmartNavigation Property

Gets or sets a value indicating whether smart navigation is enabled.

[Visual Basic]
Public Property SmartNavigation As Boolean
[C#]
public bool SmartNavigation {get; set;}
[C++]
public: __property bool get_SmartNavigation();
public: __property void set_SmartNavigation(bool);
[JScript]
public function get SmartNavigation() : Boolean;
public function set SmartNavigation(Boolean);

Property Value

true if smart navigation is enabled; otherwise, false.

Remarks

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.

When a page is requested by an Internet Explorer 5.5 browser, or later, smart navigation enhances the user's experience of the page by performing the following:

  • eliminating the flash caused by navigation.
  • persisting the scroll position when moving from page to page.
  • persisting element focus between navigations.
  • retaining only the last page state in the browser's history.

Smart navigation is best used with ASP.NET pages that require frequent postbacks but with visual content that does not change dramatically on return. Consider this carefully when deciding whether to set this property to true.

Example

[Visual Basic] 
Sub Page_Load(Sender As Object, e As EventArgs)

   Me.SmartNavigation = true
End Sub
Sub Button_Click(Sender As Object, e As EventArgs)

   Label1.Text="<b>The value of 'SmartNavigation' property is </b>" + "'" + Me.SmartNavigation.ToString() + "'"
End Sub

[C#] 
void Page_Load(Object sender, EventArgs e)
{
   this.SmartNavigation = true;
}
void Button_Click(Object sender, EventArgs e)
{
   Label1.Text="<b>The value of 'SmartNavigation' property is </b>" + "'" + this.SmartNavigation + "'";
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace

Show:
© 2014 Microsoft