SPAM-LOW: [thelist] ASP.NET: String or Control

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Mon Dec 13 14:15:42 CST 2004


	For this, you could just render a string with a link in it if
necessary, so you could replace your placeholder with a Literal (no need
to use a placeholder just to render a string).

	OR, if you might need to put something else in there, try this:
create the correct control at run time, and then say

pageToEdit.Controls.Add(myNewControl)

...and that new control will be rendered on the spot.

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Casey Crookston

How can I create a placeholder which is either a string or a control.
If re-edit is true then I just need to hold a string.  If it's false
then it needs to contain a URL.

Thanks,

Casey

<script runat="server">
   Sub Page_Load(Src As Object, E As EventArgs)
   dim reedit as string = Request.Form("reedit")
   Dim userControl As Control
   If reedit="true" then
        ???????
        pageToEdit = Request.Form("inpContent")
   Else
         userControl = Page.LoadControl("content/" &
Request.QueryString("page") & ".ascx")
         pageToEdit.Controls.Add(userControl)
  End If
end sub
</script>

...

 <asp:PlaceHolder id="pageToEdit" runat="server"/>





More information about the thelist mailing list