Click here to Skip to main content
15,894,460 members
Articles / Web Development / ASP.NET

Callback WebControls

Rate me:
Please Sign up or sign in to vote.
4.80/5 (44 votes)
5 Jan 2010Ms-PL9 min read 124.2K   1.3K   105  
The power of callback and JavaScript to render controls without reloading the entire page.
using System;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
using System.Web.UI.HtmlControls;
using System.Web.UI.Design.WebControls;


namespace WebGui.AECheckBox
{
    public class AECheckBoxDesigner : CheckBoxDesigner
    {
       
        public override bool AllowResize
        {
            get
            {
                return true;
            }
        }

        public override string GetDesignTimeHtml()
        {
            // Component is the control instance, defined in the base
            // designer
            AECheckBox chk = (AECheckBox)Component;

            if (chk.ID != "" && chk.ID != null)
            {
                StringWriter sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);

                chk.RenderCheckBox(tw);

                return sw.ToString();
            }
            else
                return GetEmptyDesignTimeHtml();

            
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Architect
Belgium Belgium
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions