Saturday, March 31, 2012
Server side HTML printing
I am using a rich text editor (FCKEdit) on a webpage in which user can
enter formatted text.
The output of this control is HTML. Now on the code behind side, I need
to change some of this HTML and then print the HTML (the pretty
document - not the code) on the server printer.
Any ideas'
Thanks in advance<sprash25@.gmail.com> wrote in message
news:1149837637.843058.67720@.i39g2000cwa.googlegroups.com...
> Hi,
> I am using a rich text editor (FCKEdit) on a webpage in which user can
> enter formatted text.
> The output of this control is HTML. Now on the code behind side, I need
> to change some of this HTML and then print the HTML (the pretty
> document - not the code) on the server printer.
> Any ideas'
> Thanks in advance
>
Well, I can help you with the capture of the html side. The printing is
another matter. This code will capture the html just before it get sent to
the client. You also google for 'asp.net output html save'
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim _stringBuilder As StringBuilder = New StringBuilder()
Dim _stringWriter As StringWriter = New StringWriter(_stringBuilder)
Dim _htmlWriter As HtmlTextWriter = New HtmlTextWriter(_stringWriter)
MyBase.Render(_htmlWriter)
Dim html As String = _stringBuilder.ToString()
'here is where you can manipulate or save to file or database or maybe print
the html output string
writer.Write(html) 'this writes the page back out
End Sub
Mike
Server side HTML printing
I am using a rich text editor (FCKEdit) on a webpage in which user can
enter formatted text.
The output of this control is HTML. Now on the code behind side, I need
to change some of this HTML and then print the HTML (the pretty
document - not the code) on the server printer.
Any ideas??
Thanks in advance<sprash25@.gmail.com> wrote in message
news:1149837637.843058.67720@.i39g2000cwa.googlegro ups.com...
> Hi,
> I am using a rich text editor (FCKEdit) on a webpage in which user can
> enter formatted text.
> The output of this control is HTML. Now on the code behind side, I need
> to change some of this HTML and then print the HTML (the pretty
> document - not the code) on the server printer.
> Any ideas??
> Thanks in advance
Well, I can help you with the capture of the html side. The printing is
another matter. This code will capture the html just before it get sent to
the client. You also google for 'asp.net output html save'
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
Dim _stringBuilder As StringBuilder = New StringBuilder()
Dim _stringWriter As StringWriter = New StringWriter(_stringBuilder)
Dim _htmlWriter As HtmlTextWriter = New HtmlTextWriter(_stringWriter)
MyBase.Render(_htmlWriter)
Dim html As String = _stringBuilder.ToString()
'here is where you can manipulate or save to file or database or maybe print
the html output string
writer.Write(html) 'this writes the page back out
End Sub
Mike
Server Side Include showing up in Screen Display
I am trying to include a subroutine in my aspx file, but when I do it shows up in the screen output. I have a sub and end sub as the first and last lines in the script, and I put the include statement near the top of the file. (See below)
<%@dotnet.itags.org. Page Language="VBScript" Debug="true" %>
<%@dotnet.itags.org. Import Namespace="System.IO" %>
<%@dotnet.itags.org. Import Namespace="System.Data.OleDb" %>
<!--#include file="Get_Database_value.vbs"-->
<script runat="server">
Sub Page_Load
Response.Write ("Nothing")
End Sub
</script>
If I try to put the include inside the script directives it flags that as an error. I have read how includes could be used for headers and footers, but for that you put the includes inside the <html> </html> tags. I am coming from an asp background where I just included the file with vb code at the top of the asp page and it worked fine. I have read some things about the configuration file and how you can put compiled code in subdirectories, but right now I just want to get it to work.
Thanks for any help
Fred Rodriguez
Hi,
I believe it is not the right way to attached a script file. At ASP.NET you can put all your code/classes under App_Code folder in the root directory of your code. And normally classes in ASP.Net 2.0 uses .vb extension.
I suggest you change your Get_Database_value.vbs into a .net 2.0 format and put it under App_Code. If your using Visual Studio Express it's very easy to add App_Code folder.
Cheers...
Saturday, March 24, 2012
Server.Execute and its output
Quick quesiton. Is it considered a good practice or at least not a bad practice to remove all code except the page declaration from an aspx page that will be called by Server.Execute? The reason why I would do this is to elminate the garbage htm tags that get passed back into my requesting page.
Thanks,
Fatthippo
A little more info for you. I'm requesting the aspx file to get to its methods in aspx.cs. Sooooo that's why i'm removing everything from the aspx page accept the page declaration. That way the server.execute doesn't return anything but the methods output from the codebehind file.
Back to my question - Is this a hack? Is there a better solution?
Hello,
That's a good idea. You can also use Response.Rederect() or cross-page to another page which you want to show. They seems similar with each other.