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. VIew State in CustomControl

VIew State in CustomControl

Scheduled Pinned Locked Moved ASP.NET
helphostingdata-structures
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 a problem with maintaining view state in WebCustomControl. The problem is that i want to create a generic search control. All controls that is used in search criteria is passed from hosting page e.g TextBox txt1 = new TextBox(); TextBox txt2 = new TextBox(); TextBox txt3 = new TextBox(); Control[] c ={ txttest, txt1, txt2, txt3 }; SearchControl.WebCustomControl1.AddControls(c); Where Add control is Satic method in webcustom control its code is as public static void AddControls(Control[] Controls) { UIControls = Controls; } where UIControls is static Control array defined in Custom control I then Render the control as protected override void RenderContents(HtmlTextWriter output) { output.Write(""); for (int i = 0; i < UIControls.Length; i++) { output.Write(" "); output.Write(" "); output.Write(" "); } output.Write(" "); output.Write(" "); output.Write(" "); output.Write("

    "); UIControls[i].RenderControl(output); output.Write("

    "); output.Write(""); output.Write(""); output.Write("

    "); } Now the problem is that when i access any of the control, its value is lost! Any one that can help me plz regards

    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