I am trying (without any luck) to find a way to parse a string and output its
processed results.
ie:
string text = "This is text from a CMS tool <asp:Label runat=\"server\"
id=\"test\" text=\"Hello World\" />";
OR
string text = "Current date is: <%=DateTime.Now.ToString() %>";
Response.Write(SomeHowEvaluateText(text));
Any ideas?
--
-Steven 5 1366
Steven,
It isn't entirely clear from your post exactly what the goal is, but maybe
this will help. In the first example, it looks like you are attempting to
render a declarative Label control into the Response Output stream, that
won't work at all.
In your second example you could do the following:
string text = "Current date is:" +DateTime.Now.ToString() ;
Response.Write(text);
The issue here is that declarative markup, e.g. "<asp:Label ...." is
processed when the page runs through the server. You CAN add a label control
dynamically in your codebehind, if that helps. That would be something like
(using a placeholder control):
Label lbl = new Label();
lbl.Text="This is the text";
lbl.Id="Label1";
Placeholder1.Controls.Add(lbl);
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote: I am trying (without any luck) to find a way to parse a string and output its processed results.
ie:
string text = "This is text from a CMS tool <asp:Label runat=\"server\" id=\"test\" text=\"Hello World\" />";
OR
string text = "Current date is: <%=DateTime.Now.ToString() %>";
Response.Write(SomeHowEvaluateText(text));
Any ideas?
-- -Steven
Hi Peter,
I am not trying to programatically add controls or concatinate strings
together; rather I need to parse/evaluate ASP.NET code and render the output.
For context purposes, this is needed for a CMS-like application where the
data is stored in a DB and I want users to be able to leverage the ASP.NET
runtime.
The full field may look something like this:
string text = @"Hello world. The current date is <%=DateTime.Now%>. <br
/><br />Here is a custom control:<sb:TestControl runat=""server"" id=""test""
/>";
I want to be able to render the output of this to the page.
--
-Steven
"Peter Bromberg [C# MVP]" wrote: Steven,
It isn't entirely clear from your post exactly what the goal is, but maybe this will help. In the first example, it looks like you are attempting to render a declarative Label control into the Response Output stream, that won't work at all.
In your second example you could do the following:
string text = "Current date is:" +DateTime.Now.ToString() ;
Response.Write(text);
The issue here is that declarative markup, e.g. "<asp:Label ...." is processed when the page runs through the server. You CAN add a label control dynamically in your codebehind, if that helps. That would be something like (using a placeholder control):
Label lbl = new Label(); lbl.Text="This is the text"; lbl.Id="Label1"; Placeholder1.Controls.Add(lbl);
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote:
I am trying (without any luck) to find a way to parse a string and output its processed results.
ie:
string text = "This is text from a CMS tool <asp:Label runat=\"server\" id=\"test\" text=\"Hello World\" />";
OR
string text = "Current date is: <%=DateTime.Now.ToString() %>";
Response.Write(SomeHowEvaluateText(text));
Any ideas?
-- -Steven
OK. You're talking about stuff like Virtual Path Providers, which is a new
feature in ASP.NET 2.0. Here's a link to an article that should point you in
the right direction: http://support.microsoft.com/?id=910441
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote: Hi Peter,
I am not trying to programatically add controls or concatinate strings together; rather I need to parse/evaluate ASP.NET code and render the output.
For context purposes, this is needed for a CMS-like application where the data is stored in a DB and I want users to be able to leverage the ASP.NET runtime.
The full field may look something like this:
string text = @"Hello world. The current date is <%=DateTime.Now%>. <br /><br />Here is a custom control:<sb:TestControl runat=""server"" id=""test"" />";
I want to be able to render the output of this to the page. -- -Steven
"Peter Bromberg [C# MVP]" wrote:
Steven,
It isn't entirely clear from your post exactly what the goal is, but maybe this will help. In the first example, it looks like you are attempting to render a declarative Label control into the Response Output stream, that won't work at all.
In your second example you could do the following:
string text = "Current date is:" +DateTime.Now.ToString() ;
Response.Write(text);
The issue here is that declarative markup, e.g. "<asp:Label ...." is processed when the page runs through the server. You CAN add a label control dynamically in your codebehind, if that helps. That would be something like (using a placeholder control):
Label lbl = new Label(); lbl.Text="This is the text"; lbl.Id="Label1"; Placeholder1.Controls.Add(lbl);
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote:
I am trying (without any luck) to find a way to parse a string and output its processed results.
ie:
string text = "This is text from a CMS tool <asp:Label runat=\"server\" id=\"test\" text=\"Hello World\" />";
OR
string text = "Current date is: <%=DateTime.Now.ToString() %>";
Response.Write(SomeHowEvaluateText(text));
Any ideas?
-- -Steven
Hi Peter,
First off, thanks for all of your assistance so far -this is definitely a
push in the right direction!
Unfortunatly I don't think this will do it for me as I do not want to serve
up virtual pages, rather, I will have an ASP.NET page (that it based off a
master page) that contains a webcontrol (think of a literal control for
simplicity sake) whos job it will be to emit the rendered content of ASP.NET
controls and code from a database table.
--
-Steven
"Peter Bromberg [C# MVP]" wrote: OK. You're talking about stuff like Virtual Path Providers, which is a new feature in ASP.NET 2.0. Here's a link to an article that should point you in the right direction:
http://support.microsoft.com/?id=910441
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote:
Hi Peter,
I am not trying to programatically add controls or concatinate strings together; rather I need to parse/evaluate ASP.NET code and render the output.
For context purposes, this is needed for a CMS-like application where the data is stored in a DB and I want users to be able to leverage the ASP.NET runtime.
The full field may look something like this:
string text = @"Hello world. The current date is <%=DateTime.Now%>. <br /><br />Here is a custom control:<sb:TestControl runat=""server"" id=""test"" />";
I want to be able to render the output of this to the page. -- -Steven
"Peter Bromberg [C# MVP]" wrote:
Steven,
It isn't entirely clear from your post exactly what the goal is, but maybe this will help. In the first example, it looks like you are attempting to render a declarative Label control into the Response Output stream, that won't work at all.
In your second example you could do the following:
string text = "Current date is:" +DateTime.Now.ToString() ;
Response.Write(text);
The issue here is that declarative markup, e.g. "<asp:Label ...." is processed when the page runs through the server. You CAN add a label control dynamically in your codebehind, if that helps. That would be something like (using a placeholder control):
Label lbl = new Label(); lbl.Text="This is the text"; lbl.Id="Label1"; Placeholder1.Controls.Add(lbl);
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote:
> I am trying (without any luck) to find a way to parse a string and output its > processed results. > > ie: > > string text = "This is text from a CMS tool <asp:Label runat=\"server\" > id=\"test\" text=\"Hello World\" />"; > > OR > > string text = "Current date is: <%=DateTime.Now.ToString() %>"; > > Response.Write(SomeHowEvaluateText(text)); > > Any ideas? > > -- > -Steven
You could still use a custom Virtual Path Provider for this. Providers can
also be chained, so if something isn't found, it would fallback to th
Previous (the default) provider. If you have stuff coming out of a database,
this could be the way to go because it gives you the ability to store
user-specific code and controls in a database table column / row and key off
of something like a querystring item.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Steven Berkovitz" wrote: I am trying (without any luck) to find a way to parse a string and output its processed results.
ie:
string text = "This is text from a CMS tool <asp:Label runat=\"server\" id=\"test\" text=\"Hello World\" />";
OR
string text = "Current date is: <%=DateTime.Now.ToString() %>";
Response.Write(SomeHowEvaluateText(text));
Any ideas?
-- -Steven This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gerrit Holl |
last post by:
Posted with permission from the author.
I have some comments on this PEP, see the (coming) followup to this message.
PEP: 321
Title: Date/Time Parsing and Formatting
Version: $Revision: 1.3 $...
|
by: Terry |
last post by:
Hi,
This is a newbie's question. I want to preload 4 images and only when
all 4 images has been loaded into browser's cache, I want to start a
slideshow() function. If images are not completed...
|
by: Rashida |
last post by:
Hi all!
I have written a function to fetch lebels from xml file for
cross-language interoperability. Please refer function code below.
I am invoking itfrom my asp page saying...
|
by: Lucas Tam |
last post by:
Hi all,
Does anyone know of a GOOD example on parsing text with text qualifiers?
I am hoping to parse text with variable length delimiters/qualifiers. Also,
qualified text could run onto...
|
by: Earl |
last post by:
I'm curious if there are others who have a better method of
accepting/parsing phone numbers. I've used a couple of different techniques
that are functional but I can't really say that I'm totally...
|
by: JaythePCguy |
last post by:
Hi,
I am trying to write a text parser to group all nonprintable and
control characters, spaces and space delimited words in different
groups using Regex class. Using a parsing of...
|
by: ankitdesai |
last post by:
I would like to parse a couple of tables within an individual player's
SHTML page. For example, I would like to get the "Actual Pitching
Statistics" and the "Translated Pitching Statistics"...
|
by: toton |
last post by:
Hi,
I have some ascii files, which are having some formatted text. I want
to read some section only from the total file.
For that what I am doing is indexing the sections (denoted by .START
in...
|
by: Chris Carlen |
last post by:
Hi:
Having completed enough serial driver code for a TMS320F2812
microcontroller to talk to a terminal, I am now trying different
approaches to command interpretation.
I have a very simple...
|
by: martinsson |
last post by:
Hi all!
I'm pretty mad about this... dont know what is going on.
Im parsing XML file that looks like this:
<something>
__<item att="something">text<item>
__<item...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |