.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> Ajax >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Ajax WatermarkerExtender and CalendarExtender for Dynamic HTML Control

Posted By:Sasi Prabhu       Posted Date: April 14, 2012    Points: 40    Category: Ajax    URL: http://www.dotnetspark.com  

Insert a Rows into Table and dynamically add the HTML textbox and add the WatermarkerExtender, CalenderExtender for Dynamic Textbox.

Step 1 :
  Create a Table and Add a HTML Button in .aspx Page.
Step 2 :
  Add the ScriptManager into your Page.

Step 3 :
Register the AjaxToolKit Assembly into .aspx Page.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
Step 4 :
  Add this Javascript Code into your Page.
function returnAddRow(){
 var table = $get("ChapterTable");
 var row = table.insertRow(table.rows.length);
 var cell1 = row.insertCell(0);
 cell1.innerHTML = "
$create(AjaxControlToolkit.TextBoxWatermarkBehavior, { "ClientStateFieldID": "txtwe_ClientState" + ControlId , "WatermarkText": "dd-MMM-yyyy", "WatermarkCssClass":"watermark", "id": "tWaterMarktxt" + ControlId }, null, null, $get("txt" + ControlId));
Step 5 :
  To Create Calender Extender in Javascript
      function CalenderExtender(txtId) {
          try {
              if ($find("CalendarExtender")) {
              $create(AjaxControlToolkit.CalendarBehavior, { "format": "dd-MMM-yyyy", "id": "CalendarExtender" }, null, null, txtId);
          catch (e) {
Step 6 :
  Now Run.


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend