Ask a Question related to ASP.NET General, Design and Development.
-
Rick Spiewak #1
How to insert dynamically generated HTML into the <body> of an ASP.NET page?
I need to generate a "buy" button as part of an ASP.NET page - this consists
of a small HTML form with hidden fields, conforming to the requirements of a
merchant credit card processor. PayPal is similar.
I'm succeeding in doing this by using Writer.Write to emit my HTML, at least
as far as getting it to work.
However, depending on where I put MyBase.Render(Writer), I get my HTML
either before the header or after the end of the body of the HTML generated
by ASP.NET. Oddly enough, both Netscape and IE seem to be happy to handle
this. But, it looks ugly and is probably non-compliant.
Anyone have any ideas as to how to split the difference and get my added
HTML form into the <body>?
TIA
Rick Spiewak
Rick Spiewak Guest
-
unable to execute a javascript in a dynamically generated HTML
Hi, I have a dynamically generated HTML code rendered on a browser instance created though code (AxSHDocVw.AxWebBrowser instance) . I have... -
extract body-content from HTML page online
Hi everybody, I need to include an online web page in my own one. My first attempt was to include() that page. This way all the HTML framework... -
Fit to Page Option in Printing HTML generated by ASP
Hey all I have an asp which page which generates an html page. When I print the page 2-3 lines go to the next page. If there a way in... -
How to Dynamically insert JavaScript into a Page Header
Hello, From a user control what is the best way ( other than static ) to insert JavaScript include in the Head of an HTML page <head> <script... -
What is the prefered way to insert HTML in a page.
In ASP you use <% =HtmlString %> but in ASP.NET this can cause some problems if you are using page inheritance. What is the prefered way to... -
Ken Cox [Microsoft MVP] #2
Re: How to insert dynamically generated HTML into the <body> of an ASP.NET page?
Off the top of my head, I wonder if adding a Literal server control to hold the
content would serve your purpose? It is made to sit inside the existing
server-side <form>. Maybe I've missed something?
Ken
"Rick Spiewak" <rickspiewak@mindspring.com> wrote in message
news:OZvkaIjUDHA.2224@TK2MSFTNGP10.phx.gbl...
I need to generate a "buy" button as part of an ASP.NET page - this consists
of a small HTML form with hidden fields, conforming to the requirements of a
merchant credit card processor. PayPal is similar.
I'm succeeding in doing this by using Writer.Write to emit my HTML, at least
as far as getting it to work.
However, depending on where I put MyBase.Render(Writer), I get my HTML
either before the header or after the end of the body of the HTML generated
by ASP.NET. Oddly enough, both Netscape and IE seem to be happy to handle
this. But, it looks ugly and is probably non-compliant.
Anyone have any ideas as to how to split the difference and get my added
HTML form into the <body>?
TIA
Rick Spiewak
Ken Cox [Microsoft MVP] Guest
-
bruce barker #3
Re: How to insert dynamically generated HTML into the <body> of an ASP.NET page?
a literal control won't work because you cannot nest forms in html. the
easisest way is to write a function that renders the html and call from the
page:
<body>
<% RenderBuyForm(); %>
<form runat=server id=myform>
......
</form>
</body>
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> wrote in message
news:en#YfMjUDHA.1872@TK2MSFTNGP12.phx.gbl...hold the> Off the top of my head, I wonder if adding a Literal server control toconsists> content would serve your purpose? It is made to sit inside the existing
> server-side <form>. Maybe I've missed something?
>
> Ken
>
> "Rick Spiewak" <rickspiewak@mindspring.com> wrote in message
> news:OZvkaIjUDHA.2224@TK2MSFTNGP10.phx.gbl...
> I need to generate a "buy" button as part of an ASP.NET page - thisa> of a small HTML form with hidden fields, conforming to the requirements ofleast> merchant credit card processor. PayPal is similar.
>
> I'm succeeding in doing this by using Writer.Write to emit my HTML, atgenerated> as far as getting it to work.
>
> However, depending on where I put MyBase.Render(Writer), I get my HTML
> either before the header or after the end of the body of the HTML> by ASP.NET. Oddly enough, both Netscape and IE seem to be happy to handle
> this. But, it looks ugly and is probably non-compliant.
>
> Anyone have any ideas as to how to split the difference and get my added
> HTML form into the <body>?
>
> TIA
>
> Rick Spiewak
>
>
>
bruce barker Guest
-
Rick Spiewak #4
Re: How to insert dynamically generated HTML into the <body> of an ASP.NET page?
Thanks for your suggestion. But, anything which creates another <form>
tag at design time causes errors. I'm looking for an event (for example)
to tie into which lets me emit HTML inside of the <body> tag. Or, even
inside the <html> tags, since more than one <body> is (still?)
technically OK.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Rick Spiewak Guest
-
Rick Spiewak #5
Re: How to insert dynamically generated HTML into the <body> of an ASP.NET page?
I am successfully using Bruce's suggestion. One subtlety - the routine gets
called extra times. I found I can avoid this by using:
' Prevent double-painting of screen - wait for Render event
If Not Rendering Then Exit Function
Rendering = False
where "Rendering" is a boolean flag set to true in the Render override:
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Rendering = True
MyBase.Render(writer)
End Sub
"abacnet" <abacnet@hotmail.com> wrote in message
news:%2301efnrUDHA.1872@TK2MSFTNGP12.phx.gbl...any> What about using a protected variable in the code behind (protected
> mstrMyVariable as string="") then fill it by whatever value you want atexisting> time. Then somewhere in your HTML code add <% =mstrMyVariable %>(you may
> need to add quotes) . I use this and it works fine.
>
>
> "bruce barker" <nospam_brubar@safeco.com> wrote in message
> news:%23EQoHTkUDHA.2200@TK2MSFTNGP11.phx.gbl...> the> > a literal control won't work because you cannot nest forms in html. the
> > easisest way is to write a function that renders the html and call from> > page:
> >
> > <body>
> > <% RenderBuyForm(); %>
> > <form runat=server id=myform>
> > .....
> > </form>
> > </body>
> >
> >
> >
> >
> > "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> wrote in message
> > news:en#YfMjUDHA.1872@TK2MSFTNGP12.phx.gbl...> > hold the> > > Off the top of my head, I wonder if adding a Literal server control to> > > content would serve your purpose? It is made to sit inside therequirements> > consists> > > server-side <form>. Maybe I've missed something?
> > >
> > > Ken
> > >
> > > "Rick Spiewak" <rickspiewak@mindspring.com> wrote in message
> > > news:OZvkaIjUDHA.2224@TK2MSFTNGP10.phx.gbl...
> > > I need to generate a "buy" button as part of an ASP.NET page - this> > > of a small HTML form with hidden fields, conforming to theadded> of> handle> > a> > least> > > merchant credit card processor. PayPal is similar.
> > >
> > > I'm succeeding in doing this by using Writer.Write to emit my HTML, at> > generated> > > as far as getting it to work.
> > >
> > > However, depending on where I put MyBase.Render(Writer), I get my HTML
> > > either before the header or after the end of the body of the HTML> > > by ASP.NET. Oddly enough, both Netscape and IE seem to be happy to> > > this. But, it looks ugly and is probably non-compliant.
> > >
> > > Anyone have any ideas as to how to split the difference and get my>> >> > > HTML form into the <body>?
> > >
> > > TIA
> > >
> > > Rick Spiewak
> > >
> > >
> > >
> >
>
Rick Spiewak Guest
-
Lewis Wang [MSFT] #6
Re: How to insert dynamically generated HTML into the <body> of an ASP.NET page?
Hi Rick,
I am glad to hear that. Thank you for sharing the knowledge in the
newsgroup.
Best Regards,
Lewis
Get Secure! - [url]www.microsoft.com/security[/url]
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Reply-To: "Rick Spiewak" <rickspiewak@mindspring.com>
| From: "Rick Spiewak" <rickspiewak@mindspring.com>
| References: <OZvkaIjUDHA.2224@TK2MSFTNGP10.phx.gbl>
<en#YfMjUDHA.1872@TK2MSFTNGP12.phx.gbl>
<#EQoHTkUDHA.2200@TK2MSFTNGP11.phx.gbl>
<#01efnrUDHA.1872@TK2MSFTNGP12.phx.gbl>
| Subject: Re: How to insert dynamically generated HTML into the <body> of
an ASP.NET page?
| Date: Fri, 1 Aug 2003 01:27:04 -0400
| Lines: 98
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <eEhAM2#VDHA.1896@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 209-6-243-228.c3-0.frm-ubr1.sbo-frm.ma.cable.rcn.com
209.6.243.228
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:164027
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I am successfully using Bruce's suggestion. One subtlety - the routine
gets
| called extra times. I found I can avoid this by using:
|
| ' Prevent double-painting of screen - wait for Render event
|
| If Not Rendering Then Exit Function
|
| Rendering = False
|
|
|
| where "Rendering" is a boolean flag set to true in the Render override:
|
|
|
| Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)
|
| Rendering = True
|
| MyBase.Render(writer)
|
| End Sub
|
|
|
| "abacnet" <abacnet@hotmail.com> wrote in message
| news:%2301efnrUDHA.1872@TK2MSFTNGP12.phx.gbl...
| > What about using a protected variable in the code behind (protected
| > mstrMyVariable as string="") then fill it by whatever value you want at
| any
| > time. Then somewhere in your HTML code add <% =mstrMyVariable %>(you
may
| > need to add quotes) . I use this and it works fine.
| >
| >
| > "bruce barker" <nospam_brubar@safeco.com> wrote in message
| > news:%23EQoHTkUDHA.2200@TK2MSFTNGP11.phx.gbl...
| > > a literal control won't work because you cannot nest forms in html.
the
| > > easisest way is to write a function that renders the html and call
from
| > the
| > > page:
| > >
| > > <body>
| > > <% RenderBuyForm(); %>
| > > <form runat=server id=myform>
| > > .....
| > > </form>
| > > </body>
| > >
| > >
| > >
| > >
| > > "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> wrote in
message
| > > news:en#YfMjUDHA.1872@TK2MSFTNGP12.phx.gbl...
| > > > Off the top of my head, I wonder if adding a Literal server control
to
| > > hold the
| > > > content would serve your purpose? It is made to sit inside the
| existing
| > > > server-side <form>. Maybe I've missed something?
| > > >
| > > > Ken
| > > >
| > > > "Rick Spiewak" <rickspiewak@mindspring.com> wrote in message
| > > > news:OZvkaIjUDHA.2224@TK2MSFTNGP10.phx.gbl...
| > > > I need to generate a "buy" button as part of an ASP.NET page - this
| > > consists
| > > > of a small HTML form with hidden fields, conforming to the
| requirements
| > of
| > > a
| > > > merchant credit card processor. PayPal is similar.
| > > >
| > > > I'm succeeding in doing this by using Writer.Write to emit my HTML,
at
| > > least
| > > > as far as getting it to work.
| > > >
| > > > However, depending on where I put MyBase.Render(Writer), I get my
HTML
| > > > either before the header or after the end of the body of the HTML
| > > generated
| > > > by ASP.NET. Oddly enough, both Netscape and IE seem to be happy to
| > handle
| > > > this. But, it looks ugly and is probably non-compliant.
| > > >
| > > > Anyone have any ideas as to how to split the difference and get my
| added
| > > > HTML form into the <body>?
| > > >
| > > > TIA
| > > >
| > > > Rick Spiewak
| > > >
| > > >
| > > >
| > >
| > >
| >
| >
|
|
|
Lewis Wang [MSFT] Guest



Reply With Quote

