PC Review


Reply
Thread Tools Rate Thread

Building a control that loads its template from a database

 
 
DC
Guest
Posts: n/a
 
      29th Jan 2007
Hi,

I have the requirement to build a control that will read its template
from a database. (I call all the stuff one would normally place
between the start and end tag of a placeholder in a usercontrol
"template" here.) The purpose is to provide HTML snippets with the
ability tho change the .ascx part without manipulating and deploying
files.

I see the TemplateControl class and its "LoadTemplate" control but
that seems to load from a physical path only (I am restricted to
framework 1.1). Does someone know an approach or a code sample for
what I want to do?

TIA for any hint,
Regards
DC

 
Reply With Quote
 
 
 
 
sticky
Guest
Posts: n/a
 
      29th Jan 2007
that could be complicated

if you just want to display static html, with no .net controls, then
try overriding the render method for the control and outputting the
stored template then.

if you want to have controls in your usercontrol, and do things like
saving their viewstate then things will become a lot more complicated.

you could try serializing the controls to the database and then
deserializing them and loading them (you have to do this on page_init
for them to be automatically added to the viewstate)

you can also dynamically create user controls, which could be the
easiest way i think


its difficult to know what is the best option with out more
information on what you are trying to do.


On 29 Jan, 16:20, "DC" <d...@upsize.de> wrote:
> Hi,
>
> I have the requirement to build a control that will read its template
> from a database. (I call all the stuff one would normally place
> between the start and end tag of a placeholder in a usercontrol
> "template" here.) The purpose is to provide HTML snippets with the
> ability tho change the .ascx part without manipulating and deploying
> files.
>
> I see the TemplateControl class and its "LoadTemplate" control but
> that seems to load from a physical path only (I am restricted to
> framework 1.1). Does someone know an approach or a code sample for
> what I want to do?
>
> TIA for any hint,
> Regards
> DC


 
Reply With Quote
 
DC
Guest
Posts: n/a
 
      1st Feb 2007
Thanks sticky,

I did not find a proper way to load templates without using file
access. I therefore changed the requirements and will load the ascx
from a file now (LoadControl). My main intent is that the ascx code is
kept in a database, so I will implement a mechanism to sync the data
with a .ascx file.

Regards
DC


On Jan 29, 6:15 pm, "sticky" <tchap...@sis.tv> wrote:
> that could be complicated
>
> if you just want to display static html, with no .net controls, then
> try overriding the render method for the control and outputting the
> stored template then.
>
> if you want to have controls in your usercontrol, and do things like
> saving their viewstate then things will become a lot more complicated.
>
> you could try serializing the controls to the database and then
> deserializing them and loading them (you have to do this on page_init
> for them to be automatically added to the viewstate)
>
> you can also dynamically create user controls, which could be the
> easiest way i think
>
> its difficult to know what is the best option with out more
> information on what you are trying to do.
>
> On 29 Jan, 16:20, "DC" <d...@upsize.de> wrote:
>
>
>
> > Hi,

>
> > I have the requirement to build a control that will read its template
> > from a database. (I call all the stuff one would normally place
> > between the start and end tag of a placeholder in a usercontrol
> > "template" here.) The purpose is to provide HTML snippets with the
> > ability tho change the .ascx part without manipulating and deploying
> > files.

>
> > I see the TemplateControl class and its "LoadTemplate" control but
> > that seems to load from a physical path only (I am restricted to
> > framework 1.1). Does someone know an approach or a code sample for
> > what I want to do?

>
> > TIA for any hint,
> > Regards
> > DC- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
marss
Guest
Posts: n/a
 
      1st Feb 2007

DC wrote:
> Hi,
>
> I have the requirement to build a control that will read its template
> from a database. (I call all the stuff one would normally place
> between the start and end tag of a placeholder in a usercontrol
> "template" here.) The purpose is to provide HTML snippets with the
> ability tho change the .ascx part without manipulating and deploying
> files.
>


Why not to use a web custom control? Is is more suitable for dinamic
content loading.
http://msdn.microsoft.com/library/de...ebcontrols.asp

 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changes to inventry control database template =?Utf-8?B?ZGF2ZXlib3kzMDA=?= Microsoft Access Database Table Design 1 29th Aug 2005 01:49 PM
Embedded Control in IE, control loads but get System.Security.Permissions.SecurityPermission request error in IE... Marco Microsoft Dot NET Framework Forms 0 24th Jan 2005 03:41 PM
Embedded Control in IE, control loads but get System.Security.Permissions.SecurityPermission request error in IE... Marco Microsoft Dot NET Framework 0 24th Jan 2005 03:41 PM
Genealogy database template - ActiveX Control required for downlo. =?Utf-8?B?SWFuIEJyb29rcw==?= Microsoft Access 0 20th Nov 2004 02:57 PM
Is it possible to call a layout template when a page loads??? Alex Microsoft ASP .NET 0 18th Mar 2004 11:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 AM.