DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   How to add data to the content place holder at runtime (http://www.daniweb.com/forums/thread117007.html)

psspl Apr 2nd, 2008 8:57 am
How to add data to the content place holder at runtime
 
hi all,

i am developing a content management system in asp.net with C#. i have a master page named "Master1.master" with 5 content place holders-"cphHeader, cphLeft,cphCenter,cphright,cphbottom". i have another default.aspx page which is inherited from the "Master1.master". it takes as input,the following fields from the user :
1. text to be displayed.(Textbox)
2. Content holder where the text will be displayed (dropdown having names of all the 5 content holders mentioned above.).
these things entered by the user are stored in the database. The text entered by the user should be displayed in the content holder mentioned above.

How do i do it?? is there any facility which helps us access the content place holders on the default.aspx.cs page.

thanks in advance.please reply as soon as possible.

plazmo Apr 2nd, 2008 4:39 pm
Re: How to add data to the content place holder at runtime
 
you access your content tags.
they look like this.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"></asp:Content>

then you just call it from the c# code by id
ex.
Content1.Controls.Add(acontrolfilledwithcontent)

psspl Apr 3rd, 2008 1:23 am
Re: How to add data to the content place holder at runtime
 
Quote:

Originally Posted by plazmo (Post 575449)
you access your content tags.
they look like this.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"></asp:Content>

then you just call it from the c# code by id
ex.
Content1.Controls.Add(acontrolfilledwithcontent)




Thanks for the reply. but i cannot access 'Content1 ' in my '.cs' page.is there any other solution??

SheSaidImaPregy Apr 4th, 2008 5:13 pm
Re: How to add data to the content place holder at runtime
 
place your code, only your content place holder code like the above example, and I will try to help you.

Hosam Kamel Apr 4th, 2008 7:59 pm
Re: How to add data to the content place holder at runtime
 
you can use another a[approach by using the new ASP.NET 2.0 control which called MultiView control and set the active view depending on selected dropdown item.

http://www.c-sharpcorner.com/UploadF...a-393c43872384


All times are GMT -4. The time now is 1:23 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC