Ajax Sample

Create a sample AJAX application named as "AjaxWebsite" in VS 2008 .



Add a new AjaxWebform into it



This will add the new Ajax ScriptManager tag into the page

Drap & Drop below controls from the Toolbox (ctrl + Alt + t , for ToolBox)

UpdatePanel , Label & Button


Place label & button inside the Updatepanel .

From the source view make sure the button & label is inside the UpdatePanel ContentTemplate .

Open ajaxforms.aspx.cs

Paste this inside the class

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Page Load Time :"+DateTime.Now.ToString();
}

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Button Click Time :"+DateTime.Now.ToString();
}

Attach button event in the Html Source
asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"

try now .

Note : ScriptManager should be in the top of all controls