Thursday, 3 October 2013

Ajax UpdatePanel Control Example in ASP.NET using C#.NET

Hi friends, in this article I will explain about Ajax UpdatePanel Control Example in ASP.NET using C#.NET.
I already explained in the previous articles about How to turn a Textbox into a rich HTML editor using AjaxControlTookitBind,Save,Edit,Update,Cancel,Delete,Paging example in GridView in ASP.NET using VB.NET and Validation in MVC 4 Razor with the Data Annotation Validators in “MODEL” in C#

In ASP.NET:
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ajax UpdatePanel Control Example in ASP.NET</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate >
      <fieldset>
                <legend>UpdatePanel</legend>
                <asp:Label ID="DisplayDateTime" runat="server" Text="Panel created."></asp:Label><br />
                <asp:Button ID="btnDisplay" runat="server" OnClick="btnDisplay_Click" Text="Display Current DateTime" />
      </fieldset>
      </ContentTemplate>
      </asp:UpdatePanel>
    </div>   
    </form>
</body>
</html>


In C#.NET:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AutoComplete : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtDate.Text = DateTime.Now.ToString();
     
    }
    protected void btnDisplay_Click(object sender, EventArgs e)
    {
        txtDate.Text = DateTime.Now.ToString();
        DisplayDateTime.Text = DateTime.Now.ToString();
    }
}

No comments:

Post a Comment

© 2012-2014 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.