Custom ASP.NET Container Control

前端 未结 8 1917
醉话见心
醉话见心 2020-12-14 20:50

I\'ve been trying to create a custom control that works exactly like the Panel control except surrounded by a few divs and such to create a rounded box look. I haven\'t been

8条回答
  •  甜味超标
    2020-12-14 21:26

    Create a class that inherits System.Web.UI.Control, and overrride the Render ( HtmlTextWriter ) method. In this method, render surrounding start tags, then render the children(RenderChildren), then render end tags.

    protected override void Render ( HtmlTextWriter output )
    {
      output.Write ( "
    " ); RenderChildren ( output ); output.Write ( "
    " ); }

    Rounded corners is typically achieved using CSS and corner images for the top left, top right, bottom left and bottom right corners. It could be done using 4 nested divs, acting as layers, each of them having one corner image as their background image.

提交回复
热议问题