Microsoft MVP성태의 닷넷 이야기
Tip/Trick: Enabling Back/Forward-Button Support for ASP.NET AJAX UpdatePanel [링크 복사], [링크+제목 복사]
조회: 9443
글쓴 사람
정성태 (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)
43정성태7/17/20035761탐색기 Namespace Extension 컨테이너 (VC 6.0, ATL) 2002.03.24파일 다운로드1
42정성태7/17/20034286KBManager WebBand (VC 6.0, ATL/Script) 2001.10.01파일 다운로드1
41정성태7/17/20034357UrlMonDownload (VC 6.0, ATL) 2001.06.16파일 다운로드1
40정성태7/17/20034304IE 북마크 임포트 (VC 6.0, ATL, MFC 지원) 2001.01.20파일 다운로드1
39정성태7/17/20034875MsIE.exe (VC 6.0, ATL, HTML Parser 로서의 IHTMLDocument2 이용 및 IE 보안설정) 2000.11.23파일 다운로드1
38정성태7/17/20034589EnumIE.exe (VC 6.0, ATL, 현재 사용 중인 IE에 접속) 2000.10.24파일 다운로드1
37정성태7/17/20034330ReuseIE.exe (VC ++ 6,0, Internet Explorer 재사용) 2000.04.17파일 다운로드1
36정성태7/17/20033930RemoteViewer dll (VC ++ 6.0, ATL) 2000.03.13파일 다운로드1
35정성태7/17/20034236IESpy dll (VC ++ 6.0, ATL) 2000.02.28파일 다운로드1
34정성태7/17/20033972Bmp2Gif 콘트롤 (VC ++ 6.0, MFC) 2000.02.28파일 다운로드1
33정성태7/17/20033788Gif89a 콘트롤 (VC ++ 6.0, ATL) 2000.02.28파일 다운로드1
32정성태7/17/20034294이미지 4버튼 (VC ++ 6.0, ATL) 2000.02.28파일 다운로드1
31정성태7/17/20033916이미지 홀더 (VC ++ 6.0, ATL) 2000.02.28파일 다운로드1
30정성태7/17/20034044이미지 뷰어 (VC ++ 6.0, ATL) 2000.02.28파일 다운로드1
29정성태7/17/20033825ChatClient (VC ++ 6.0, MFC) 1999.09.09파일 다운로드1
28정성태7/17/20035221Winsock2 SPI : LSP 예제 (VC ++ 6.0) 2001.08.07파일 다운로드1
27정성태7/17/20034329Echo Services Server (VC ++ 6.0, ATL Service) 2001.01.07파일 다운로드1
26정성태7/17/20037355FTP Client (VC ++ 6.0, MFC) 1999.09.14파일 다운로드1
25정성태7/17/20033725모뎀 정보를 알아내는 클래스 (VC ++ 6.0, MFC) 1999.09.12파일 다운로드1
24정성태7/17/20038452Ping (VC ++ 6.0, MFC, CSocket Class) 1999.09.09 [1]파일 다운로드1
23정성태7/21/20037416ChatServer / ChatClient (VC ++ 6.0, MFC, Win32 API Socket) 1999.08.01파일 다운로드2
22정성태7/17/20033884성능 객체 카운터 (VC 6.0, Win32) 2001.07.07파일 다운로드1
21정성태7/17/20033910StringSplit 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
20정성태7/17/20034179SQLDirect 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
19정성태7/17/20033579ImeControl 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
18정성태7/17/20034011RegistryEx 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
1  2  3  4  5  6  [7]  8