Microsoft MVP성태의 닷넷 이야기
Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel [링크 복사], [링크+제목 복사],
조회: 9520
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel
; http://weblogs.asp.net/scottgu/archive/2006/09/14/Tip_2F00_Trick_3A00_-Enabling-Back_2F00_Forward_2D00_Button-Support-for-ASP.NET-AJAX-UpdatePanel.aspx


Nikhil recently posted a nice blog post that includes a new ASP.NET AJAX-enabled control called "HistoryControl". When added to a page it allows developers to programmatically add logical views into a browser's history list. This enables you to make AJAX enabled sites much more useful, and to follow the standard back/forward navigation paradigm that traditional web apps follow.

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()
;
}

Once you add entries into the history control, the back/forward button will be enabled in the browser. Nikhil's history control then exposes a "Navigate" event which fires when you press the forward or back button in the browser, and this event then exposes the identifier entry provided before when the view was added into the browser history. You can then use this to restore the page to whatever state it should be in to match the previous history item and update the page:

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();
}

And now your end-users get forward/back button history navigation working with AJAX. You can download the code for Nikhil's history control and start using it here.

Hope this helps,

Scott

Share this post: Email it! | bookmark it! | digg it! | reddit!







[최초 등록일: ]
[최종 수정일: 9/16/2006]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-동일조건변경허락 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

비밀번호

댓글 작성자
 




1  2  3  4  5  [6]  7  8 
NoWriterDateCnt.TitleFile(s)
69정성태10/27/20065071.NET : 1. Typed DataSet 에서의 ExcludeSchema 사용
68정성태1/27/20075350Vista : 2. Elevate through ShellExecute
67정성태10/22/20064788Vista : 1. Programmatically determine if an application requires elevation
66정성태9/22/20064459Tip/Trick: UpdateProgress Control and AJAX Activity Image Animations
65정성태9/15/20069520Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel
64정성태2/23/20074432Why are NameValueCollection lookups slower than Hashtable? [Kim Hamilton]
63정성태8/30/20064330WinFormResizer for .NET 2.0, v.2.0.0020.3 Released!
62정성태8/21/20064154Stylistic differences in using
61정성태8/5/20064766Detecting Information Card Support (CardSpace!) in a browser
60정성태7/22/20064532JonGallant WebControls v1.0 - ScrollableContainer
59정성태3/2/20065810.NET이 왜 성공할 수밖에 없는가?
58정성태10/5/20055208한국 MSDN - 홈지기가 번역한 MSDN Magazine 자료
57정성태5/5/20054599구구단 프로그램을 제외하고, 벤더종속적이지 않은 프로그래밍 언어가 있나요?
53정성태3/4/20055911[마소 연재 기사: 2004-05] 특집 X-Inernet : 닷넷 스마트 클라이언트 [4]파일 다운로드1
52정성태3/4/20056163[마소 연재 기사: 2004-04] 실전!강의실 - IE에서 닷넷 스마트 클라이언트 개발 3파일 다운로드1
51정성태3/4/20056533[마소 연재 기사: 2004-03] 실전!강의실 - IE에서 닷넷 스마트 클라이언트 개발 2파일 다운로드1
55정성태3/30/20055217    답변글 [추가] 기본 보안만으로 구현하는 스마트 클라이언트 이벤트 구현
50정성태3/4/20059057[마소 연재 기사: 2004-02] 실전!강의실 - IE에서 닷넷 스마트 클라이언트 개발 1 [3]파일 다운로드1
49정성태9/7/20068055RSA 공개키/개인키 암호화, DES 암호화, MD5 단방향 해시 암호화 클래스 (C#) 2002.09.25파일 다운로드1
48정성태7/17/20036205C# 으로 만든 Base64 인코딩/디코딩 클래스 (C#) 2002.09.24파일 다운로드1
47정성태7/17/20035135C# 으로 만든 DLL 을 Managed C++ 에서 이용하는 예제 (C#, Managed C++) 2002.08.01파일 다운로드1
46정성태7/17/20035289.NET으로 만든 COM+ 객체를 HTML에서 사용 (C#, COM+) 2002.06.10파일 다운로드1
45정성태7/17/20035464COM+ 객체 원격 접근예제 (VC 6.0, ATL, COM+) 2002.05.31파일 다운로드1
44정성태7/17/20035383Win32 API Hook (VC 6.0, ATL) 2002.05.12파일 다운로드1
54정성태3/21/20054455    답변글 [추가]: 최근 나온 소개된 관련 기사파일 다운로드2
43정성태7/17/20036122탐색기 Namespace Extension 컨테이너 (VC 6.0, ATL) 2002.03.24파일 다운로드1
1  2  3  4  5  [6]  7  8