473,395 Members | 1,761 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,395 software developers and data experts.

Adding User Controls at Runtime

Hi

I am upgrading an ASP site where the content is being pulled from a database. On the ASP site the DB content included form tags and other html controls. I want to replace these with a user control but am not sure how to get the controls rendered correctly at runtime. If I output the content as text, it will not realise that the tags are actually user controls and will just render them as text as this content will not be parsed

Essentially I think I need to sort of re-load the page or in some way get the server to re-parse it? Does anyone have any ideas on how to do this. I am aware of the LoadControl command but to use this requires me to do a manual parsing of the DB content using string manipulation or regular expressions both of which are fairly dodgy. Any better ideas

Thanks
Nov 18 '05 #1
1 1300

"Linda Wienholt" <an*******@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
Hi,

I am upgrading an ASP site where the content is being pulled from a database. On the ASP site the DB content included form tags and other html
controls. I want to replace these with a user control but am not sure how
to get the controls rendered correctly at runtime. If I output the content
as text, it will not realise that the tags are actually user controls and
will just render them as text as this content will not be parsed.
Essentially I think I need to sort of re-load the page or in some way get the server to re-parse it? Does anyone have any ideas on how to do this. I
am aware of the LoadControl command but to use this requires me to do a
manual parsing of the DB content using string manipulation or regular
expressions both of which are fairly dodgy. Any better ideas?
Thanks


You could use a <div id="..." runat=server> in your page, declare it as
HtmlGenericControl
and set the InnerHtml of that control.

HOWEVER:
- the asp.net page already contains a <form> tag, and you cannot nest
<form>'s
- you can't access input fields in your content in a ".net way", only read
the results with Request[]
- the html needs to be "well-formed": you can't open a tag in one div, and
then close
it in another.
Hans Kesting
Nov 18 '05 #2

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

Similar topics

3
by: Dunc | last post by:
I'm writing an app that uses a lot of time-date functions, so I'm trying to create a calendar-type user control that adds a day, month, and year box to a number of places on my page. I can...
2
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling...
2
by: Sam Kuehn | last post by:
There has been a lot of articles on how to load user controls at runtime in the Init() method. UserControl myControl = (UserControl)LoadControl(stringControl); I add the control in the Init()...
0
by: Mantorok | last post by:
Hi I want to add multiple user controls at runtime when the user clicks a certain button, however everytime I add the control a 2nd time it only adds it once. I understand that on each server...
4
by: rushikesh.joshi | last post by:
Hi All, I have created my own WebControl and want to add it in my aspx page at runtime. it's compiling perfectly, but when i m going to execute, it gives me error of "Object reference not set...
3
by: MikeY | last post by:
Hi everyone, I'm trying to figure out, on my windows form, of what is the best way to add various custom controls at various times during run-time. The problem is that they will need to be in...
3
by: Toe Dipper | last post by:
In short we have a lengthy process when a form is loaded that adds activex controls to our windows form. This process in itself works fine however we would like to push this processing to a thread...
0
by: sonic | last post by:
I am trying to dynamically load a validator and must be missing something elementary here. I extended TextBox control to add some functionality to it. One new feature it contains is IsRequired...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.