Hi,
VS.NET 2003 on WinXPPro + all latest service packs etc.
I have a totally standard WebForm wherein I need to include one of several
HTML files according to various parameters etc.
I'm trying to use an <asp:Literal /> control for this, and intend to modify
its Text property in the Page_Load event, but it's not working. The code I'm
using is as follows:
<table>
<tr>
<td>
<asp:Literal ID=litText Runat=server Text='<!--#include
file="history.htm"-->' />
</td>
</tr>
</table>
However, although the include appears to be correctly written out when I do
a View Source on the page, its contents are not displayed. If I hardcode the
include, it works perfectly, as follows:
<table>
<tr>
<td>
<!--#include file="history.htm"-->'
</td>
</tr>
</table>
Any assistance gratefully appreciated.
Best,
Mark Rae 4 1938
Including cannot assign value to control property that way. Try it this way:
<asp:Literal ID=litText Runat=server >
<!--#include file="history.htm"-->
</asp:Literal>
E.g put the include part inside the Literal's tag
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist http://blogs.aspadvice.com/joteke
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl... Hi,
VS.NET 2003 on WinXPPro + all latest service packs etc.
I have a totally standard WebForm wherein I need to include one of several HTML files according to various parameters etc.
I'm trying to use an <asp:Literal /> control for this, and intend to
modify its Text property in the Page_Load event, but it's not working. The code
I'm using is as follows:
<table> <tr> <td> <asp:Literal ID=litText Runat=server Text='<!--#include file="history.htm"-->' /> </td> </tr> </table>
However, although the include appears to be correctly written out when I
do a View Source on the page, its contents are not displayed. If I hardcode
the include, it works perfectly, as follows:
<table> <tr> <td> <!--#include file="history.htm"-->' </td> </tr> </table>
Any assistance gratefully appreciated.
Best,
Mark Rae
The contents of the string Literal is not processed by ASP.NET and so the
control is simply rendered to the page in its literal text form.
As the #include is a server side directive the string on its own is useless
once it reaches the client. Try reading the contents of history.htm and
then using the literal control to output that to the client.
MattC
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:#z**************@TK2MSFTNGP10.phx.gbl... Hi,
VS.NET 2003 on WinXPPro + all latest service packs etc.
I have a totally standard WebForm wherein I need to include one of several HTML files according to various parameters etc.
I'm trying to use an <asp:Literal /> control for this, and intend to
modify its Text property in the Page_Load event, but it's not working. The code
I'm using is as follows:
<table> <tr> <td> <asp:Literal ID=litText Runat=server Text='<!--#include file="history.htm"-->' /> </td> </tr> </table>
However, although the include appears to be correctly written out when I
do a View Source on the page, its contents are not displayed. If I hardcode
the include, it works perfectly, as follows:
<table> <tr> <td> <!--#include file="history.htm"-->' </td> </tr> </table>
Any assistance gratefully appreciated.
Best,
Mark Rae
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl... Including cannot assign value to control property that way. Try it this
way: <asp:Literal ID=litText Runat=server > <!--#include file="history.htm"--> </asp:Literal>
E.g put the include part inside the Literal's tag
Thanks very much! That solves the problem if I hardcode the reference to the
include file. However, I still need to change it in the Page_Load event.
I've tried the following with no success:
protected Literal litText;
private void Page_Load(object sender, System.EventArgs e)
{
litText.Text = "<!--#include file=\"history.htm\"-->";
}
As before, that causes the include to appear in View Source, but doesn't
write it out to the browser. It's almost like I need an InnerHTML
property...
Regards,
Mark
"MattC" <m@m.com> wrote in message
news:OS*************@tk2msftngp13.phx.gbl...
Matt, The contents of the string Literal is not processed by ASP.NET and so the control is simply rendered to the page in its literal text form.
As the #include is a server side directive the string on its own is
useless once it reaches the client. Try reading the contents of history.htm and then using the literal control to output that to the client.
Excellent advice! I did:
StreamReader objStreamReader = File.OpenText(strIncludeFile);
litText.Text = objStreamReader.ReadToEnd();
objStreamReader.Close();
where strIncludeFile is a fully-qualified filespec which I set in code, and
that worked perfectly.
Thanks a lot.
Mark This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Collin VanDyck |
last post by:
I have a basic understanding of this, so forgive me if I am overly
simplistic in my explanation of my problem..
I am trying to get a Java/Xalan transform to pass through a numeric
character...
|
by: DrTebi |
last post by:
Hello,
I have the following problem:
I used to "encode" my email address within links, in order to avoid (most)
email spiders. So I had a link like this:
<a...
|
by: Thomas Scheffler |
last post by:
Hi,
I runned in trouble using XALAN for XSL-Transformation.
The following snipplet show what I mean:
<a href="http://blah.com/?test=test&test2=test2">Test1&</a>
<a...
|
by: johkar |
last post by:
When the output method is set to xml, even though I have CDATA around
my JavaScript, the operaters of && and < are converted to XML character
entities which causes errors in my JavaScript. I know...
|
by: Nathan Sokalski |
last post by:
I add a JavaScript event handler to some of my Webcontrols using the
Attributes.Add() method as follows:
Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
|
by: Jeremy |
last post by:
How can one stop a browser from converting
&
to
& ?
We have a textarea in our system wehre a user can type in some html code
and have it saved to the database. When the data is retireved...
|
by: Arne |
last post by:
A lot of Firefox users I know, says they have problems with validation
where the ampersand sign has to be written as & to be valid. I don't
have Firefox my self and don't wont to install it only...
|
by: InvalidLastName |
last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example:
// javascript
if (a > b)...
|
by: John Nagle |
last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally
hit content which has something like "Design & Advertising", that is,
an "&" instead of an "&". Is there some way I can get...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
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)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |