About Me

My photo
a Dynamic and Energetic guy.....

Tuesday, January 27, 2009

Simple AJAX Application

(1) Install ASP.NET AJAX VS2008

(2) Go to C:\Program Files\Microsoft ASP.NET, you can see ASP.NET 2.0 AJAX Templates for Visual Studio 2008 folder --> that implies your installation is succeeded J

(3) Open Ajax enabled ASP.NET web application through VS 2008

(4) Add two labels & one button(say Button1)

(5) Add following code sample into Page_Load() method

Label1.Text = DateTime.Now.ToString();

Label2.Text = DateTime.Now.ToString() ;

(6) Run the application & check the text changes in labels(both change)

(7) Now time to add AJAX extensions

a. Toolbox --> AJAX Extensions --> UpdatePanel

(8) Add “UpdatePanel” control into webpage

(9) Drag Label2 into the “UpdatePanel” area

(10) Run the application & check the changes in labels(both change)

(11) Now go to the “Source” tab of webpage

(12) After the > ContentTemplate tag add the following code sample

<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />

</Triggers>

(13) Run the application & check the changes in labels(Now only Label1 change)

(14) Your AJAX panel is working J

No comments:

My Masters