CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 7/31/2007 3:49:38 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 30 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
Screamager45
Asp.Net User
AddContentTemplate syntax help!7/31/2007 3:49:38 PM

0/0

Hi Think I posted this in the wrong forum so I am trying again in here. Any help greatly appreciated... 

I am dynamically adding ContentPlaceHolders to a page using the following code...

base.AddContentTemplate(<ContentPlaceHolder name>, new CompiledTemplateBuilder(new BuildTemplateMethod(this.Build)));

Then the build function is as follows...

public void Build(Control c)
{

Literal b = new Literal();
b.ID = "Literal_id";
b.Text = "Content Place Holder content";
c.Controls.Add(b);

}

I am trying to work out a way of putting the Build method in a seperate class file (PageBuild.cs), but I am having trouble calling it from my default.aspx.cs page. 

Does anyone have any tips on the syntax for this?  

Thanks in advance

Dave

Johnson2007
Asp.Net User
Re: AddContentTemplate syntax help!8/2/2007 5:06:12 AM

0/0

Try to implement this method an abstract method.

public abstract void Build(Control c)
{
    //...
}
And involk it as the following.

base.AddContentTemplate(<ContentPlaceHolder name>, new CompiledTemplateBuilder(new BuildTemplateMethod(PageBuild.Build)));

 


Johnson
Screamager45
Asp.Net User
Re: AddContentTemplate syntax help!8/2/2007 9:25:15 AM

0/0

Unfortunately that didn't work.

I'll keep looking

 Thanks anyway

 

Amanda Wang - M
Asp.Net User
Re: AddContentTemplate syntax help!8/3/2007 5:46:11 AM

0/0

Hi Dave,

If you wan to put the Build menthod in a seperate class file, Before you call it, you need to declare your PageBuild:

Like below:

 PageBuild buider = new PageBuild();


base.AddContentTemplate("ContentPlaceHolder" + i.ToString(), new CompiledTemplateBuilder(new BuildTemplateMethod(buider.Build)));

 

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
Screamager45
Asp.Net User
Re: AddContentTemplate syntax help!8/3/2007 8:47:41 AM

0/0

Thanks I'm pretty sure I tried that already and it didn't work, but it was giving another error which I have since fixed so it's working now!!

Ha! sometimes you stare at this stuff for ages and can't see these answers for looking! God Bless forums! :D

 Thanks for the help!

5 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
AddContentTemplate syntax help! - ASP.NET Forums Filed under: mater page, syntax, AddContentTemplate. Re: AddContentTemplate syntax help! ... Re: AddContentTemplate syntax help! ...
Page.AddContentTemplate Method (System.Web.UI) Assembly: System.Web (in System.Web.dll). Syntax. Visual Basic (Declaration). Protected Friend Sub AddContentTemplate ( _ templateName As String, ...
Page.AspCompatEndProcessRequest Method (System.Web.UI) Namespace: System.Web.UI Assembly: System.Web (in system.web.dll). Syntax ... AddContentTemplate Method · AddOnPreRenderCompleteAsync Method ...
K. Scott Allen : The MasterPage Article I Thought I’d Never Finish Bill: You have to be careful with using syntax like Request.Form["xyz"], because names ..... AddContentTemplate("ContentPlaceHolder1", new TestContent()); ...
ng.adobe-macromedia-forums.macromedia-adobeair-general - fix error ... 2.0 menu control not working in beta 2 · web hosts reseller programmes · users in role · ok...just shoot me · addcontenttemplate syntax help! All Times Are GMT .
ng.asp-net-forum.visual_web_developer_2005_express - fix error ... need help on vb2005 about control two id at same time~whch is dropdownlist and textbox .... addcontenttemplate syntax help! All Times Are GMT.
ng.adobe-macromedia-forums.macromedia-adobeair-general - fix error ... 2.0 menu control not working in beta 2 · web hosts reseller programmes · users in role · ok...just shoot me · addcontenttemplate syntax help! All Times Are GMT .
ng.asp-net-forum.visual_web_developer_2005_express - fix error ... need help on vb2005 about control two id at same time~whch is dropdownlist and textbox .... addcontenttemplate syntax help! All Times Are GMT.
ng.adobe-macromedia-forums.macromedia-adobeair-general - fix error ... 2.0 menu control not working in beta 2 · web hosts reseller programmes · users in role · ok...just shoot me · addcontenttemplate syntax help! All Times Are GMT .
ng.asp-net-forum.visual_web_developer_2005_express - fix error ... need help on vb2005 about control two id at same time~whch is dropdownlist and textbox .... addcontenttemplate syntax help! All Times Are GMT.




Search This Site:










dnn 3.0.8, how to use clientapi with c#

replacing links in a sting

treeview not expanding

conversion to asp.net 2.0

upgrade error from 3.2.0-->3.2.2 help!!!

buttons

logged in user email

how to change dotnetnuke.install.resources?

scrollbar on a datagrid

dnn 3.1.1 super user not working..

execute code on logout

anyone beta testing new speerio products for 3.x?

what happened to c# code in starter kits??

storing client files path problem

portal alias conundrums

how to create user manually(password format error)

error "unable to start debugging on the web server. logon failure: unknown user name or bad password. see help for more information."

2 level static horizontal menu w/ menu control

community starter kit

smtp setting ???

where are the dll's?

using legacy <form> tags in codebehind

context menu - tray icon

production authentication problems...

dynamic controls

would this be possible? (video related)

freetextbox integration

localize a datagrid

contacts and user defined modules in one

windows authentication - when can we expect?

 
All Times Are GMT