Dynamic AJAX Control Toolkit – Calendar Extender

Hi friend,
Some time we need to bind any server side control from code behind i.e .cs file of aspx page .for example
if i want to create a Text box form code behind we simple create an object of Text Box for example


            TextBox txtDate = new TextBox();
            txtDate.ID = "txtDate";
            phDate.Controls.Add(txtDate); // here phDate is a Place holder on Aspx Page

            //Now we need to add a Ajax Calendar Extender at Text Box so we should add Calendar dynamically on the code behind.

            AjaxControlToolkit.CalendarExtender calenderDate = new AjaxControlToolkit.CalendarExtender();
            calenderDate.ID = "calenderDate";
            calenderDate.TargetControlID = "txtDate";
            calenderDate.Format = "dd/MM/yyy";
            phDate.Controls.Add(calenderDate);]


 finally we get a dynamically control render on the page like this ,

0 comments: