473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Inject custom web controls into a string

H

I'm struggling to think this one through

At run time I want to be able to read a layout HTML file from a database which includes tags for modules, e.g

<HTML><BODY><table><tr><td><ModuleTag>1</ModuleTag></td><td><ModuleTag>2</ModuleTag></td></tr></table></BODY></HTML

I would then like to, at run time, interpret the module tags and replace them with custom web controls (e.g., Announcement, Article). The reason for doing this at run time is that I do not know the structure of the layout (there could be more tags placed in a more complex layout)

I could tackle it as follows
* Have a page (Page.aspx) with a PlaceHolder (phLayout)
* Split the layout html at the module tags to end up with a collection of controls (literals and custom
- Literal1 = "<HTML><BODY><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"width=\"100%\"><tr><td>
- CustomWebControl1 = Module
- Literal2 = "</td><td>
- CustomWebControl2 = Module
- Literal3 = "</td></tr></table></BODY></HTML>
* Add the controls to the placeholde

Is there a simpler way

Thanks
Steven
Nov 15 '05 #1
1 1507
You have a good idea, using a PlaceHolder control is pretty
straightforward.Take a look at the Community Starter Kit on
http://www.asp.net. It will dynamically load user controls (in ascx
files) into the placeholders using LoadControl. The control to load
depends on various cutomization settings, so this type of architecture
allows for dramatic changes in content layout in a simple manner.

--
Scott
http://www.OdeToCode.com

On Sat, 6 Mar 2004 08:11:05 -0800, Steven
<an*******@discussions.microsoft.com> wrote:
Hi

I'm struggling to think this one through.

At run time I want to be able to read a layout HTML file from a database which includes tags for modules, e.g:

<HTML><BODY><table><tr><td><ModuleTag>1</ModuleTag></td><td><ModuleTag>2</ModuleTag></td></tr></table></BODY></HTML>

I would then like to, at run time, interpret the module tags and replace them with custom web controls (e.g., Announcement, Article). The reason for doing this at run time is that I do not know the structure of the layout (there could be more tags placed in a more complex layout).

I could tackle it as follows:
* Have a page (Page.aspx) with a PlaceHolder (phLayout).
* Split the layout html at the module tags to end up with a collection of controls (literals and custom)
- Literal1 = "<HTML><BODY><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"width=\"100%\"><tr><td>"
- CustomWebControl1 = Module1
- Literal2 = "</td><td>"
- CustomWebControl2 = Module2
- Literal3 = "</td></tr></table></BODY></HTML>"
* Add the controls to the placeholder

Is there a simpler way?

Thanks,
Steven


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
21
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a...
3
by: Angel | last post by:
Hi, I have a page which shows a matrix of names and grades for given period. All the grades fields must be editable and they can be up to 200 fields (20 students with 10 grades each) Since...
3
by: Hope Paka | last post by:
I want to use my custom url extension instead of .aspx. I can achieve this by writing a custom handler that implements the IHttpHandlerFactory. In the GetHandler method of the IHttpHandlerFactory i...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
1
by: sklett | last post by:
I want to implement a simple form element focus script that will change the color of a form element when it gets focus and revert back when it loses focus. I've got the code working (simple) but...
4
by: Rick | last post by:
Hello, I built a composite web control that has a textbox and a date control. added my custom control on a webform where there are other standard controls. Each control on the form has a...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.