c# - Adding html to CreateChildControls() method -
I am using MOSS 2007 within my CreateChildControls () method in my webpart, I have the following code:
Protected Override Zero CreateChildControls () {base.CreateChildControls (); Panel myPanel = new panel (); MyPanel.ID = "SelectionPanel"; This.Controls.Add (myPanel); This.myGridView = New GridView (); CreateMyGridView (referee myGridView); MyPanel.Controls.Add (myGridView); This._btnUpdate = New button (); This._btnUpdate.Text = "Update"; MyPanel.Controls.Add (_btnUpdate); This._btnUpdate.Click + = New EventHeader (_btnUpdate_Click); }
My question is how to insert html so that I wrap a div around these controls, without RenderWebPart () Method.
I am trying to get it because I do not want to use a panel whose ID will be a self-agent Client ID.
Many thanks,
I'm not sure if any reason Because it will not work for any webpage, but it seems that the move to web user control:
protected override zero CreateChildControls () {base.CreateChildControls (); Var Container = New System Web.UI.HtmlControls.HtmlGenericControl ("div"); Container.Attributes.Add ("ID", "SelectionPanel"); Text box TB = new text box (); Container.Controls.Add (TB); This.Controls.Add (Container); }