Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > .NET

Reply
 
LinkBack Thread Tools
Old November 28th, 2005, 05:46 PM   #1
New Member
 

Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Afroblanca is on a distinguished road
How to deal with dynamic controls?

I want to have re-usable page elements on my site. These elements will be laid out in HTML, and will use server controls and custom controls.
A simple example for a page element would be something like this:

<b>foo!bar! <jl:MyCustomControl id=\"myCustom\" runat=\"server\"></jl:MyCustomControl> baz!quux!</b>
(where jl is the tag prefix for the namespace that contains my custom controls)

It would seem that .ASCX user controls would be perfect for something like this. However, user controls cannot be used across applications. .NET 2.0 gives us the ability to precompile user controls, which are then usable across applications. However, I need a non-programmer to be able to make changes to these user controls. Hence, precompiling seems to be out of the question.

I feel like I can accomplish what I need by saving a given page element to a string in the database. We'll call this string the "input string". I can then render the input string through a user control of some sort. However, there's a snag - how do I render the input string in such a way that the control tags are properly rendered as controls?

I've tried to do simple things like this :
this.Response.Write(strInputString);

However, in place of my custom control, it outputs nothing at all.
What are some good strategies for solving this problem? Is it necessary to have something that parses the input string, builds a controls hierarchy, and then adds that hierarchy to the webform? If so, is there anything built into .NET that can help me?
Afroblanca is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 29th, 2005, 09:47 AM   #2
Reputable Member
 

Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 u2orange is on a distinguished road
Re: How to deal with dynamic controls?

Have you thought of exposing the properties of your control so you can pass parameters to it?

HTH
u2orange is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 29th, 2005, 12:05 PM   #3
New Member
 

Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Afroblanca is on a distinguished road
Re: How to deal with dynamic controls?

Quote:
Originally Posted by u2orange
Have you thought of exposing the properties of your control so you can pass parameters to it?
HTH
I will certainly be using parameters to change the appearance of some things. Stylesheets are useful in this respect as well. However, I'm talking about changing the basic layout of an element. So, imagine that I have some sort of sidebar with lots of different controls - ad rotators, images, hyperlinks, etc. I want to give the designer the ability to move these about and change their appearance at will.

I've done a bit more research into user controls, and it seems like I may be able to use the precompilation feature in .NET 2.0 after all. Apparently, one can precompile the codebehind, and then make changes to the .ascx without recompiling. One can even add controls to the .ascx without recompiling, provided that the controls don't need to be declared in the codebehind.

Does anybody here have experience with this?
Afroblanca is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
deal , dynamic , controls


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this a good deal? Jack Franklin The Café 4 June 9th, 2008 02:54 PM
Deal-Times begemot Full Website Reviews 8 May 22nd, 2007 04:20 AM
How to deal with PNG transparency in IE6 karinne Your Design and Layout 0 February 23rd, 2007 07:21 PM


Search Engine Optimization by vBSEO 3.2.0 RC8