ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old June 10th, 2002, 07:25 PM
Kiwi Kiwi is offline
Guru-in-training
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Not where I want to be...yet!
Posts: 38 Kiwi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Template system tutorial for ASP.NET ?

I'm in the process of writing a small web app that will allow intranet users to create their own page to display personal info, hobbies, that sort of thing.

While it's easy to create the d/b entries and pull them into a standard page, I was thinking of allowing each user to define their own template page so they can "express their individuality".

I had in mind a system where they could use a normal html page designed in frontpage, with a few placeholder tags like
[%Name%]
which I could parse by reading the template file into the main display aspx page using the fso and using the replace function to insert the dynamic data before writing the new page.

The problem with this approach is that you have to manually define the replace function in each page, and recode whenever you want to add a new tag.

Is there a way to make tag creation independent of the parse page ? ie A seperate tag definition file that's read by the page that parses the template ? Are there any predefined classes or components that have this functionality ?

Reply With Quote
  #2  
Old June 11th, 2002, 12:00 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 7
Send a message via ICQ to James Yang
Make a server control that uses templates. Make it so taht it takes in a datasource object..

When you do this, you can either assign templates using
<itemtemplate> like datalist and repeater in aspxpage or u can just pull an user control as a template in runtime....

since u want to have a separate page as template, 2nd option might do the trick for ya...

and the template page would have somethign like

<%# ((ObjectNameOfDataSource)Container.DataItem).Prope rtyName%>

neway

try researching in to the areas of server controls...
__________________
Regards,

James Yang
.NET Developer / Network Engineer
MCSE, MCDBA, MCSA, CCNA

http://www.yellowpin.com/
http://www.opentechsupport.com/

Reply With Quote
  #3  
Old June 11th, 2002, 01:58 AM
Kiwi Kiwi is offline
Guru-in-training
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Not where I want to be...yet!
Posts: 38 Kiwi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Talking Thanks!

Thanks, James. Makes sense, and I'll definitely investigate the user control option. From what I understand of it, I should be able to just do a replace and substitute the tag for the ascx page in the aspx page, which would in turn parse the html template.

Should be fun to try get this working.

Reply With Quote
  #4  
Old June 11th, 2002, 04:26 AM
James Yang James Yang is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Atlanta, Georgia
Posts: 284 James Yang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 7
Send a message via ICQ to James Yang
well just ot make it clearer

you konw how repeater has a <ItemTemplate> tag thingy to assign template to the control???

well other way to assign template to the repeater is like this

Repeater1.ItemTemplate = Page.LoadTemplate("usercontrol.ascx")


so userControl can be the template and the properties of the object u assign to its DataSource property can be displayed dynamically using

<%# Container.DataItem ... %> thingy

here is a link to start you off!!
http://msdn.microsoft.com/library/d...rvercontrol.asp

hope this helps

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Template system tutorial for ASP.NET ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway