Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Web Control Designing Questions

Web Control Designing Questions

Scheduled Pinned Locked Moved ASP.NET
designsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    Xiaoming Qian
    wrote on last edited by
    #1

    I had write a WebControl and its designer.The following is som of my code [Designer("SM.WebControls.PagingControlDesigner"), ParseChildren(false)] public class PagingControl : System.Web.UI.WebControls.WebControl,INamingContainer {   [Bindable(true),   EditorAttribute(typeof(UrlEditor), typeof(UITypeEditor))]   public string FirstButtonImg   {    get{return Convert.ToString(ViewState["FirstButtonImg"]);}    set{ViewState["FirstButtonImg"] = value;}   }   protected PlaceHolder ParsedSubObjectContainer = new PlaceHolder();   protected override void CreateChildControls()   {    Panel Panel1 = new Panel();    Create some Controls and add to Panel1    Controls.Add(Panel1);    Controls.Add(ParsedSubObjectContainer);   }   protected override void AddParsedSubObject(Object obj)   {    ParsedSubObjectContainer.Controls.Add((Control)obj);   }   internal string GetDesignTimeHtml()   {    EnsureChildControls();    StringWriter sw = new StringWriter();    HtmlTextWriter writer = new HtmlTextWriter(sw);    this.RenderControl(writer);    return sw.ToString();   }   ... } public class PagingControlDesigner : ControlDesigner {   public override bool DesignTimeHtmlRequiresLoadComplete   {    get{ return true;}   }   private PagingControl PagingControlInstance;   public override void Initialize(System.ComponentModel.IComponent component)   {    this.PagingControlInstance = (PagingControl) component;    base.Initialize (component);   }   public override string GetDesignTimeHtml()   {    return PagingControlInstance.GetDesignTimeHtml();   }   ... } I faced two problems when I writing this WebControl. The First is when I try to bind the FirstButtonImg property in a web form, the expression is not evaluated.It simple pass the '<%= Expression %>' string to the property <SM:PagingControl id="PagingControl1" runat="server" FirstButtonImg='<%= Expression %>' > I do call PagingControl1.DataBind() in my WebForm's code. The second, when I am designing a WebFrom: <SM:PagingControl id="PagingControl1" runat="server">  <asp:DataGrid id="DataGrid1" runat="server">  </asp:DataGrid> </SM:Pa

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups