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. Custom panel control

Custom panel control

Scheduled Pinned Locked Moved ASP.NET
design
4 Posts 2 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.
  • I Offline
    I Offline
    Irfan x
    wrote on last edited by
    #1

    I want to creat own custom panel control to add some features into default Panel & I donot want to inhert mypanel class from Panel i am trying to use System.Web.UI.Design.ReadWriteControlDesigner to get design time festures, drag & drop control on mypanel but can't get any success I am new in Custom Controls Can you give me any pieace of code so that i can take some guidline Actualy i want to build colapsable panel Thanks Arfan

    M 1 Reply Last reply
    0
    • I Irfan x

      I want to creat own custom panel control to add some features into default Panel & I donot want to inhert mypanel class from Panel i am trying to use System.Web.UI.Design.ReadWriteControlDesigner to get design time festures, drag & drop control on mypanel but can't get any success I am new in Custom Controls Can you give me any pieace of code so that i can take some guidline Actualy i want to build colapsable panel Thanks Arfan

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, Becaus you didn't post your sample code so could not understand why your custom control doesn't work. Below is a very very simple custom panel using a custom designer which inherits from the ReadWriteControlDesigner:

      [Designer(typeof(MyPanelDesigner)),
      PersistChildren(true),
      ParseChildren(false),
      ToolboxData("<{0}:MyPanel runat=server>MyPanel</{0}:MyPanel>")]
      public class MyPanel : WebControl
      {
      public MyPanel(): base()
      {
      }
      }

      public class MyPanelDesigner : ReadWriteControlDesigner
      {
      public MyPanelDesigner(){}
      }

      For more information, you can see Design-Time Support for Web Forms[^] shahzadarfan wrote: Actualy i want to build colapsable panel I guess you might also want to check out the ASP.NET control gallery[^].

      I 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, Becaus you didn't post your sample code so could not understand why your custom control doesn't work. Below is a very very simple custom panel using a custom designer which inherits from the ReadWriteControlDesigner:

        [Designer(typeof(MyPanelDesigner)),
        PersistChildren(true),
        ParseChildren(false),
        ToolboxData("<{0}:MyPanel runat=server>MyPanel</{0}:MyPanel>")]
        public class MyPanel : WebControl
        {
        public MyPanel(): base()
        {
        }
        }

        public class MyPanelDesigner : ReadWriteControlDesigner
        {
        public MyPanelDesigner(){}
        }

        For more information, you can see Design-Time Support for Web Forms[^] shahzadarfan wrote: Actualy i want to build colapsable panel I guess you might also want to check out the ASP.NET control gallery[^].

        I Offline
        I Offline
        Irfan x
        wrote on last edited by
        #3

        Thanks for your reply its working now i was missing class atribute tag Now one other question how to render server side control from custom control with this MyPanel class I want to store some value in hidden box so that it can be availble on post back. but simple html control lose it value on post back Thanks

        M 1 Reply Last reply
        0
        • I Irfan x

          Thanks for your reply its working now i was missing class atribute tag Now one other question how to render server side control from custom control with this MyPanel class I want to store some value in hidden box so that it can be availble on post back. but simple html control lose it value on post back Thanks

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          shahzadarfan wrote: Now one other question how to render server side control from custom control with this MyPanel class There are two common ways to render the child controls of a custom control: + Override the Render method. + Override the CreateChildControls method. shahzadarfan wrote: I want to store some value in hidden box so that it can be availble on post back. but simple html control lose it value on post back Make sure that your child controls are created before the ViewState data is loaded in the control life cycle when a postback occurs

          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