Skip to main content

How To Add Dynamic AJAX Control Toolkit - Calendar Extender




<%@ Page Language="C#" AutoEventWireup="true"

CodeFile="DynamicAjaxExtender.aspx.cs"
Inherits="DynamicAjaxExtender" %>


<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManger1"
runat="server"></asp:ScriptManager>
<div>
<asp:PlaceHolder ID="placeHolder1"
runat="server"></asp:PlaceHolder>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Create" /></div>
</form>
</body>
</html>


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;

public partial class DynamicAjaxExtender : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
// Create a textbox to hold the date
TextBox dateValue = new TextBox();
dateValue.ID = "dateValue";

// Create the calendar extender
AjaxControlToolkit.CalendarExtender ajaxCalendar =
new AjaxControlToolkit.CalendarExtender();
ajaxCalendar.ID = "ajaxCalendar";
ajaxCalendar.Format = "MM/dd/yyyy";
ajaxCalendar.TargetControlID = dateValue.ID;

placeHolder1.Controls.Add(dateValue);
placeHolder1.Controls.Add(ajaxCalendar);
}
}

Comments

  1. this code is not working make only textBox not calender not add ajax

    ASHOK VYAS

    ReplyDelete

Post a Comment

Popular posts from this blog