CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Friday, September 15, 2006

Tip/Trick: Enabling Back Button in ASP.NET AJAX ATLAS UpdatePanel

Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel

For example, the below code could be written by a developer in response to a selection change within a list to to add the previous list selection to the browser's history via Nikhil's "HistoryControl":

private void ContentList_SelectedIndexChanged(object sender, EventArgs e) {
   history.AddEntry(contentList.SelectedIndex.ToString()
;
}

private void HistoryControl_Navigate(object sender, HistoryEventArgs e) {

    
int selectedIndex 0;

    if 
(String.IsNullOrEmpty(e.Identifier) == false) {
        selectedIndex 
Int32.Parse(e.Identifier);
    
}

    
// Update the content being displayed in the page
    
contentList.SelectedIndex selectedIndex;

    
// Mark the update panels as needing an update
    
mainUpdatePanel.Update();
}

Continue from ScottGu

Post a Comment