: I need some help with this. I want to assign the content of a static
: txt/html file to my string a.
It's just static text no functionality. i cannot use #inlucde here because
it's in <script>
the reason i need to include a static text/html page it's because i don't
want to escape all the characters in the html, it has some javascript it's
very hard and cumbersome
instead of
string a = "<input type=\"text\">";
i want
string a = plain html here;
actually it doesn't have to be a seperate file, any method that would allow
me to use unmodified plain html in <script runat="server"> is fine
Thanks
: I need some help with this. I want to assign the content of a static
: txt/html file to my string a.
What's the objective? Do you want to work with the content later on or
just want to use for display?
If you just want to display the content, you may like to use the
"include" ... <!--#include file="welcome.htm"-->
http://samples.gotdotnet.com/quickstart/aspplus/doc/webformssyntaxref.aspx
Loading as a control (ascx, UserControl) will be beneficial if you want
to have some functionality in the page (server side controls).
HTH
--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
Gaurav Vaish - 30 Oct 2005 19:20 GMT
: the reason i need to include a static text/html page it's because i don't
: want to escape all the characters in the html, it has some javascript it's
: very hard and cumbersome
Let me rephrase the question.
Do you want to process the text of the html file? Why do you want to store
it in a string?
--
Cheers,
Gaurav Vaish
http://mastergaurav.org
-----------------------
Howard - 30 Oct 2005 19:38 GMT
I use Response.Write(a); later on in the script so it has to be stored in a
string.
>: the reason i need to include a static text/html page it's because i don't
> : want to escape all the characters in the html, it has some javascript
[quoted text clipped - 11 lines]
> http://mastergaurav.org
> -----------------------
Gaurav Vaish - 30 Oct 2005 20:34 GMT
:I use Response.Write(a); later on in the script so it has to be stored in a
: string.
And exactly at that point, instead of doing "Response.Write(str)", just
do:
<!--#include file="main.htm"-->
You don't need to do all the headache of loading it in a string and then
emitting it out...
--
Cheers,
Gaurav Vaish
http://mastergaurav.org
-----------------------------
Howard - 30 Oct 2005 21:44 GMT
I see what youre saying. but I forgot to mention that string a is not the
final output in response.write. I cannot use this method
string a = \\static text
string b = "something";
string c = "something";
string output = b + a + c;
Response.Write(output);
So theres no way around this? I hate to escape all those lines.
> :I use Response.Write(a); later on in the script so it has to be stored in
> a
[quoted text clipped - 14 lines]
> http://mastergaurav.org
> -----------------------------
Sreejith Ram - 31 Oct 2005 17:10 GMT
not sure , if i have understood the requirement well..
> string output = b + a + c;
> Response.Write(output);
above 2 lines are eaqual to
Response.Write(b)
<!--#include file="main.htm"-->
Response.Write(c)
> I see what youre saying. but I forgot to mention that string a is not the
> final output in response.write. I cannot use this method
[quoted text clipped - 26 lines]
> > http://mastergaurav.org
> > -----------------------------
Jason Kester - 31 Oct 2005 19:40 GMT
This will work if all you want to do is append text without any HTML
garbage surrounding it:
var a = "<asp:literal id=litWhatEver runat=server/>";
Then in your codebehind:
litWhatEver.Text = @"<input type='text'>";
This will render as:
var a = "<input type='text'>";
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/