Hi,
I have an asp.net page, which uses the response.write method calls
in the Page_Load method to output dynamically to the page. Unfortunately,
this always inserts text at the beginning of the file, before the
<!DOCTYPE...> definition. I would like to control the position, so that it
always appears in a certain place in my code (within a div or span with a
defined id). I did consider using innerHTML, but this doesn't appear to work
at all, getting compiler errors. Does anyone have any other ideas?
Thanks,
Martin
--
Martin Eyles ma**********@NOSPAM.bytronic.com
_______CODE BELOW________
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.Write("TEST")
End Sub
_________Gives__________
TEST <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"> <html>
<head>
<title>TEST</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="TEST.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwtNjU0MzcyMTk1Ozs+iI5lAOcC76OEBXsnSYfQpEC sHAI=" />
</form>
</body>
</html> 8 1250
Add an appropriate asp.net control (e.g. a label) and write to it from within
the Page_Load routine.
e.g.
<asp:Label id="Label1" runat="server">Label</asp:Label>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Label1.Text = "Some text"
End Sub
HTH
Alan
"Martin Eyles" wrote: Hi, I have an asp.net page, which uses the response.write method calls in the Page_Load method to output dynamically to the page. Unfortunately, this always inserts text at the beginning of the file, before the <!DOCTYPE...> definition. I would like to control the position, so that it always appears in a certain place in my code (within a div or span with a defined id). I did consider using innerHTML, but this doesn't appear to work at all, getting compiler errors. Does anyone have any other ideas?
Thanks, Martin
-- Martin Eyles ma**********@NOSPAM.bytronic.com
_______CODE BELOW________
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Response.Write("TEST") End Sub
_________Gives__________
TEST <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>TEST</title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </head> <body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="TEST.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtNjU0MzcyMTk1Ozs+iI5lAOcC76OEBXsnSYfQpEC sHAI=" />
</form>
</body> </html>
Martin Eyles wrote: Hi, I have an asp.net page, which uses the response.write method calls in the Page_Load method to output dynamically to the page. Unfortunately, this always inserts text at the beginning of the file, before the <!DOCTYPE...> definition. I would like to control the position, so that it always appears in a certain place in my code (within a div or span with a defined id). I did consider using innerHTML, but this doesn't appear to work at all, getting compiler errors. Does anyone have any other ideas?
Thanks, Martin
Various options:
* use a <asp:Label> to output plain text (no html)
* use a <div> (or <span>) with an id argument *and* a "runat=server",
then (maybe switch briefly to design mode) you can access InnerText
and InnerHtml properties. (InnerText escapes special characters, InnerHtml
preserves them)
Hans Kesting
Response.Write writes HTML to the Response.OutputBuffer. As ASP.Net is
object-oriented ASP.Net usually handles the writing of HTML to the
Response.OutputBuffer, as it is done using UI Controls that write their own
HTML out at the approproate time. I would suggest that, rather than fighting
the model, work with it. Use the object-oriented approach that ASP.Net was
designed for. IOW, DON'T use Response.Write, unless you're writing a
spoecific type of class which would handle all its own HTML-writing.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com... Hi, I have an asp.net page, which uses the response.write method calls in the Page_Load method to output dynamically to the page. Unfortunately, this always inserts text at the beginning of the file, before the <!DOCTYPE...> definition. I would like to control the position, so that it always appears in a certain place in my code (within a div or span with a defined id). I did consider using innerHTML, but this doesn't appear to
work at all, getting compiler errors. Does anyone have any other ideas?
Thanks, Martin
-- Martin Eyles ma**********@NOSPAM.bytronic.com
_______CODE BELOW________
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Response.Write("TEST") End Sub
_________Gives__________
TEST <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>TEST</title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> </head> <body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="TEST.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtNjU0MzcyMTk1Ozs+iI5lAOcC76OEBXsnSYfQpEC sHAI=" />
</form>
</body> </html>
Thanks. Did a <div> tag as you suggested with
dispMachines.InnerHtml() = dispMachines.InnerHtml() + "HELLO"
in my vb code. Works a treat
Regards,
Martin
--
Martin Eyles ma**********@NOSPAM.bytronic.com
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:O7*************@TK2MSFTNGP14.phx.gbl... Martin Eyles wrote: Hi, I have an asp.net page, which uses the response.write method calls in the Page_Load method to output dynamically to the page. Unfortunately, this always inserts text at the beginning of the file, before the <!DOCTYPE...> definition. I would like to control the position, so that it always appears in a certain place in my code (within a div or span with a defined id). I did consider using innerHTML, but this doesn't appear to work at all, getting compiler errors. Does anyone have any other ideas?
Thanks, Martin Various options: * use a <asp:Label> to output plain text (no html) * use a <div> (or <span>) with an id argument *and* a "runat=server", then (maybe switch briefly to design mode) you can access InnerText and InnerHtml properties. (InnerText escapes special characters,
InnerHtml preserves them)
Hans Kesting
I have tried doing a similer thing with an image. There is only one copy of
the image, but it's name will come from a database, so I want to modify its
src value in my code.
In the html I have:-
<img id="lineGraphic" runat="server" src="" style="position:absolute;
z-index:0" />
And in the Page_Load method I have:-
lineGraphic.src() = "graphics/sd02main.png"
unfortunately, I get the error "Name 'lineGraphic' is not declared." in the
Task List, and the vb code does not recompile. How can I fix this?
Thanks,
Martin
--
Martin Eyles ma**********@NOSPAM.bytronic.com
"Martin Eyles" wrote:- Thanks. Did a <div> tag as you suggested with
dispMachines.InnerHtml() = dispMachines.InnerHtml() + "HELLO"
in my vb code. Works a treat
"Hans Kesting" wrote:- Various options: * use a <asp:Label> to output plain text (no html) * use a <div> (or <span>) with an id argument *and* a "runat=server", then (maybe switch briefly to design mode) you can access InnerText and InnerHtml properties. (InnerText escapes special characters, InnerHtml preserves them)
Very Strange. I just looked at the web form in Design view, and that fixed
the error in the completely seperate vb file. It also (rather anoyingly)
capitalized my html tags (<html> became <HTML>). Not sure if these are bugs
or "features". Any ideas what is causing this?
Thanks,
Martin
--
Martin Eyles ma**********@NOSPAM.bytronic.com
"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com... I have tried doing a similer thing with an image. There is only one copy
of the image, but it's name will come from a database, so I want to modify
its src value in my code.
In the html I have:- <img id="lineGraphic" runat="server" src="" style="position:absolute; z-index:0" />
And in the Page_Load method I have:- lineGraphic.src() = "graphics/sd02main.png"
unfortunately, I get the error "Name 'lineGraphic' is not declared." in
the Task List, and the vb code does not recompile. How can I fix this?
Martin Eyles wrote: Very Strange. I just looked at the web form in Design view, and that fixed the error in the completely seperate vb file. It also (rather anoyingly) capitalized my html tags (<html> became <HTML>). Not sure if these are bugs or "features". Any ideas what is causing this?
Thanks, Martin
See my earlier (cryptic) comment about switching to design mode..
The fact that you edit the html (in aspx/ascx) does not declare that
control in the codebehind file. When you switch to design-mode,
VS.Net notices some declarations are missing and adds them.
Capitalizing some tags and changing the layout of the html seems
to be considered more of a "bug", or an undesired feature.
Hans Kesting "Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message news:10*************@corp.supernews.com... I have tried doing a similer thing with an image. There is only one copy of the image, but it's name will come from a database, so I want to modify its src value in my code.
In the html I have:- <img id="lineGraphic" runat="server" src="" style="position:absolute; z-index:0" />
And in the Page_Load method I have:- lineGraphic.src() = "graphics/sd02main.png"
unfortunately, I get the error "Name 'lineGraphic' is not declared." in the Task List, and the vb code does not recompile. How can I fix this?
Thanks,
Martin
"Hans Kesting" wrote:- Martin Eyles wrote: Very Strange. I just looked at the web form in Design view, and that fixed the error in the completely seperate vb file. It also (rather anoyingly) capitalized my html tags (<html> became <HTML>). Not sure if these are bugs or "features". Any ideas what is causing this?
See my earlier (cryptic) comment about switching to design mode.. The fact that you edit the html (in aspx/ascx) does not declare that control in the codebehind file. When you switch to design-mode, VS.Net notices some declarations are missing and adds them.
Do you mean these two lines are put in when you switch to design view?
Protected WithEvents dispMachines As
System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents lineGraphic As System.Web.UI.HtmlControls.HtmlImage
Capitalizing some tags and changing the layout of the html seems to be considered more of a "bug", or an undesired feature.
Discovered something in options (Tools, Options, HTML/XML, Format,
Capitalisation) that tames the capitalisation of html. However its
equivalent for css (Tools, Options, HTML/XML, Format, Capitalisation)
appears not to work (ie. set to lowercase, and it all becomes uppercase).
--
Martin Eyles ma**********@NOSPAM.bytronic.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: xtort |
last post by:
My question is:
If you create a template in Photoshop, slice it in ImageReady, using
the CSS output option(under the "slices" menu in "output--options"),
and then use the CSS output for a...
|
by: rajek |
last post by:
I posted a similar question yesterday, but didn't get an answer that
resolved the issue. (Thanks to those who tried though.)
The background: I've read in books and online that if you have one...
|
by: rajek |
last post by:
I posted a similar question yesterday, but didn't get an answer that
resolved the issue. (Thanks to those who tried though.)
The background: I've read in books and online that if you have one...
|
by: GeorgeSmiley |
last post by:
Does anyone know of a way, via VBA, to set the screen position of
query results to a particular top, left position? I've glanced at API
techniques but cannot find exactly what will do the trick....
|
by: Bart Van der Donck |
last post by:
Hello,
I'm having a hard time trying to configure printed output that consists
of multiple pages. The idea is the following:
<div style="
border: 1px solid blue;
position: absolute;
top:...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |