HighTechTalks DotNet Forums  

Possible: dynamically populated and placed user control in the middle of a string?

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Possible: dynamically populated and placed user control in the middle of a string? in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
 
Posts: n/a

Default Possible: dynamically populated and placed user control in the middle of a string? - 12-25-2006 , 12:12 AM







I'm wondering if it's possible to do the following in ASP.NET 2.0. I want to
do the following simultaneously. I suspect its possible, but I also suspect
that I may need to do different things at different times in the page
lifecyle, and would appreciate some guidance.

a) call an ASP.NET user control in code (I know how to do this, subbing in
for a ASP.NET placeholder control )

b) interrogate my database for some information at runtime and dynamically
populate the properties of the user control using the DB values
(individually, I know how to do this too)

c) "inject" the code that comprises the user control into the middle of
another string I'm pulling out from the DB at runtime.

The real-world application here is a content mangement scenario: imagine a
user control that could hold a "mug shot" of a person and some related
information, and you wanted this user control to appear midway through the
body of a text article.

Is this possible, or not?

Thanks,
-KF



Reply With Quote
  #2  
Old   
Steven Cheng[MSFT]
 
Posts: n/a

Default RE: Possible: dynamically populated and placed user control in the middle of a string? - 12-25-2006 , 03:17 AM






Hi KF,

I have also found your another thread "Subject: impossible or not:
dynamically embedding a user control in the middle of a string?" describing
the issue in the microsoft.public.dotnet.framework.aspnet newsgroup and I
have posted my reply there.

As I also mentioned there, if you want to insert a usercontrol at a random
(not determined at design-time), I'm afraid the ASP.NET page/control model
doesn't quite support this. Even dynamic created control need a fixed
holder/container (placeholder) on the page. For your scenario, you may
consider dynamically embed some html element in the text string( such as
html <img> or <iframe> ) because such element does not require ASP.NET
runtime parsing and compilation and can link to other resources via a given
url.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.