473,785 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having a UserControl returned in a string from another UserControl to be rendered

I hope this makes sense.

Here is what I am attempting. I have an inital generic aspx page that
has one custom tag:

<web:site id=webSite runat=server/>

When this control evaluates, it will return a small amount of Html with
another custom control tag inside this html. For example:

<table>
<tr>
<td><web:page id=webPage runat=server/></td>
</tr>
</table>

In turn, this web:page control will have multiple other custom tags
called web:content. When asp.net renders this, only the initial custom
control I have embedded in the generic aspx page actually renders. The
web:site tag renders with the web:page custom control tag showing in
the rendered page source as plain text, it was never rendered.

What I need is a way to tell asp.net to render any custom control tags
I spit out inside text/html strings and have this repeat down thru a
series of controls.

How do I tell asp.net to essentially "re-render" the page. Hopefully
someone has done something similar and I am speaking clearly.

Thanks.

Dec 2 '05 #1
1 1128
I do not think you can do that. Once the page has loaded, all the controls
have been parsed and processed.

Having said that, you can dynamically load controls using the LoadControl
method and add it to the Controls collection, but once ASP.NET has finished
parsing the document, it will not parse it anymore.

Maybe your goal does not fit with a proper design. What specifically are
you trying to do and maybe I can offer a better alternative?

From your small information below, maybe a better solutions would be to
constrain your top-level control even more by requiring that it return an
actual WebControl (or something) that can then be added to the Controls
collection at the proper place.

I am always cautions to allow my code to return data that cannot be
validated for correctness. For instance, by allowing any string to be
returned, you have no idea what will be returned, while if you return a
WebControl instance, then you know that it can be rendered.

"SlimFlem" <sl******@gmail .com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I hope this makes sense.

Here is what I am attempting. I have an inital generic aspx page that
has one custom tag:

<web:site id=webSite runat=server/>

When this control evaluates, it will return a small amount of Html with
another custom control tag inside this html. For example:

<table>
<tr>
<td><web:page id=webPage runat=server/></td>
</tr>
</table>

In turn, this web:page control will have multiple other custom tags
called web:content. When asp.net renders this, only the initial custom
control I have embedded in the generic aspx page actually renders. The
web:site tag renders with the web:page custom control tag showing in
the rendered page source as plain text, it was never rendered.

What I need is a way to tell asp.net to render any custom control tags
I spit out inside text/html strings and have this repeat down thru a
series of controls.

How do I tell asp.net to essentially "re-render" the page. Hopefully
someone has done something similar and I am speaking clearly.

Thanks.

Dec 2 '05 #2

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

Similar topics

8
3195
by: Tinus | last post by:
Hello all, I've create a custom control (UserControl) and have a custom Item Collection. The control is a custom calendar which is draw using the Graphics Rectangle etc. functions. It is drawn when the control is painted or resized. When the control is drawn it draws also the items found in the collection. So far so good.... I have 3 questions which I'm unable to find a solution
2
1243
by: Phl | last post by:
Hi, I have a page with many usercontols and I would like to access other usercontrols from one usercotnrol , so I can access their server controls. This is how I do it, EditProfile UserControlep = (EditProfile)Page.FindControl("EditProfile"); This works when I debug it in my localmachine but doesn't when I have
2
3695
by: John Olsen | last post by:
Hi. I`m building a small CMS, and want to add the possibility to include server side code inside static html-strings that is stored in a database. For e.g. in the string "<div><b>News></b><br></div>", should be replaced by the rendered html-outpu from a usercontrol that prints out database content. I use regex to get the content of the -tags, and load the control and get the output-html with the following code:
1
6870
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle and page loading/rendering lifecycle.... Ok, now for the question: I have an ASPX page (page.aspx), and I have a UserControl (control.ascx). The UserControl has one textbox on the control, and one button control. I have added a public property...
12
2212
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control server. It "serves" back the required control (either WebControl or UserControl) based on the contents of an xml file. The code in the webform places each control in a TableCell. My problem is that the control server works as far as returning the...
5
1294
by: Tarun Mistry | last post by:
Hi all, is it possible to update a usercontrol before it is rendered? In my scenario I have a Page with a usercontrol on it. When a button is clicked on the Page, I want to update the usercontrol, more specifically making a placeholder become visible. However it wont work. Im confused. I catch the button click even on the page and within this i run a method on my usercontrol, however it doesnt seem to work. Few code lines given below. ...
34
2664
by: Larry Hastings | last post by:
This is such a long posting that I've broken it out into sections. Note that while developing this patch I discovered a Subtle Bug in CPython, which I have discussed in its own section below. ____________ THE OVERVIEW I don't remember where I picked it up, but I remember reading years ago that the simple, obvious Python approach for string concatenation: x = "a" + "b"
6
12141
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use binding like normal. The problem I am running into is that my UserControl ends up with a different BindingContext then the ParentForm it is contained in and thus all other controls on the parent form. (I want various controls on the form to...
14
2021
by: WT | last post by:
Hello, I have a usercontrol loaded in a page with a theme. This usercontrol contains columns template with hyperlinks, with skinID. The columns are not displayed, seems thta there is some not traceable exception triggered and the all binding is stopped. But this same named skinid is working for hyperlinks outside templates.
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.