Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 19, 2011 05:34 PM by wetlip
Member
385 Points
257 Posts
Nov 19, 2011 04:59 PM|LINK
when adding a literal dynamically it appears after the footer not in the
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
have do i refer to that space in the code behind file ?
something like
Page.Controls.Add(New LiteralControl("<h3>Value: "))
but me.content or me.contentplaceholder doessnt exists ?
Contributor
2449 Points
366 Posts
Nov 19, 2011 05:21 PM|LINK
Here is a code sample to try:
Dim a As New Label a.ID = "testing" a.Text = "Testing this out." Dim c As ContentPlaceHolder = Master.FindControl("MainContent") c.Controls.Add(a)
Thanks,,
Jason
Nov 19, 2011 05:34 PM|LINK
this works indeed
why isnt it referred at like master.maincontent ?
what is there a content id and where is it used for and a placeholder id in one tag
Master.FindControl("Maincontent").Controls.Add(New LiteralControl("Test"))
wetlip
Member
385 Points
257 Posts
how to add dynamically a control on aspx page with masterpage
Nov 19, 2011 04:59 PM|LINK
when adding a literal dynamically it appears after the footer not in the
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
have do i refer to that space in the code behind file ?
something like
Page.Controls.Add(New LiteralControl("<h3>Value: "))
but me.content or me.contentplaceholder doessnt exists ?
jgangwisch
Contributor
2449 Points
366 Posts
Re: how to add dynamically a control on aspx page with masterpage
Nov 19, 2011 05:21 PM|LINK
Here is a code sample to try:
Dim a As New Label a.ID = "testing" a.Text = "Testing this out." Dim c As ContentPlaceHolder = Master.FindControl("MainContent") c.Controls.Add(a)Thanks,,
Jason
wetlip
Member
385 Points
257 Posts
Re: how to add dynamically a control on aspx page with masterpage
Nov 19, 2011 05:34 PM|LINK
this works indeed
why isnt it referred at like master.maincontent ?
what is there a content id and where is it used for and a placeholder id in one tag
Master.FindControl("Maincontent").Controls.Add(New LiteralControl("Test"))