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 Custom Control Problem

Web Custom Control Problem

Scheduled Pinned Locked Moved ASP.NET
designhostingalgorithmsdata-structureshelp
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.
  • F Offline
    F Offline
    faiqshah
    wrote on last edited by
    #1

    Hi All I have problem regarding WebCustom Control I am trying to develop a generic WebCustomControl for searching purpose. What i am trying to do is to pass UI Controls such as labels textboxes etc from the hosting page to the webcustom control. I have a method in WebCustomControl Class that add these control to the Control Collection of the WebCustomControl. The logic of the method is public void AddControls(Controls[] UIControls) { foreach (Control control in UIControls) { this.Controls.Add(control ); } } The Method is called from the Hosting Page as TextBox txt1 = new TextBox(); txt1.ID = "txtname"; Control[] c ={ txt1}; search.AddControls(c); I creat a control array and store my textbox in it i then pass the array to the method of webcustom control. Now the problem is that when render method of the control is called the control collection of webcutomcontrol lost its value. the logic of RenderContents is as protected override void RenderContents(HtmlTextWriter output) { foreach (Control control in UIControls) { control .RenderControl(output); } } :doh:This is fairly simple but i don't know where the problem is Any assistance will be appreciated Regards Faiq shah Afridi

    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