Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Saturday, March 31, 2012

table sizing

I am in my second chapter of trying to learn asp.net and I have my first issue. I am working on an example that asks that I create a HTML table 4x2(RxC) via the web matrix interface. I am not using web matirx, I am with the Visual.NET IDE.
I have inserted a table on the webForm via the HTML tool box, the one under components, and I can not create the 4x2 table. Each time I change the Rows to 4, it keeps getting changed back to 2 when I apply the change.
Why?Vs 03 is notorious for screwing up html code.
Best bet do this:
<table>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
Alternativly i think theres an insert table command on the menu for vs03, which should let you specify 4x2 and insert you a new table.
Or if the book is working from Web Matrix then maybe you should too, after all its a free download from this site :)
Hope this helps,
Andrew
You may be better off using the web form table, not the one on the html portion of the toolbox.
Use the table menu in the top menu bar.
Zath
Thanks, I am learning quickly the quirks of VS.
Thanks.

Table to Excel

If I have built a nice pretty HTML table which has all the shading and
coloring and everthing just the way that I want it, is there some "magical"
way to easily translate this into an excel spreadsheet?
I see Excel will take a HTML file in, but when I tried to create a sample
of this but it did not correctly interperet my background color, but did
interpret my text color, which was bad because nothing displayed as they wer
e
both the same color.
I need to maintain colors, borders, shading, bolding. Do I need to create
the sheet cell by cell in code?Jim Heavey wrote:

> If I have built a nice pretty HTML table which has all the shading and
> coloring and everthing just the way that I want it, is there some "magical
"
> way to easily translate this into an excel spreadsheet?
> I see Excel will take a HTML file in, but when I tried to create a sample
> of this but it did not correctly interperet my background color, but did
> interpret my text color, which was bad because nothing displayed as they w
ere
> both the same color.
> I need to maintain colors, borders, shading, bolding. Do I need to create
> the sheet cell by cell in code?
I'd open the table up in IE, copy the table to the clipboard and then
try pasting it into excel. I'm pretty sure doing that works with
microsoft word, but I've never tried it with Excel.
Helen

table with a scrollbar?

I have a user control (HTML table) within a table. Would it be possible to
cause the user control to scroll its conents when its container is too
small, or will I just have to make its height = 100% so it can't cause its
container to resize too big?
PaulYou can put your table (or any control) into a fixed size area by putting it
in a scrollable div such as this:
<div id="Layer1" style=" position:relative;width:350px;height:200
px;overflow:
scroll;">control goes here</div>
The key is to use the "overflow" CSS attribute.Here's more info:
http://www.w3schools.com/css/pr_pos_overflow.asp
Another option is to put your control in an IFrame.
http://msdn.microsoft.com/workshop/...ects/IFRAME.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
>
Thanks, that's exactly what I was looking for.
Paul
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eI5ghT3oFHA.3912@.TK2MSFTNGP10.phx.gbl...
> You can put your table (or any control) into a fixed size area by putting
> it in a scrollable div such as this:
> <div id="Layer1"
> style=" position:relative;width:350px;height:200
px;overflow:
> scroll;">control goes here</div>
> The key is to use the "overflow" CSS attribute.Here's more info:
> http://www.w3schools.com/css/pr_pos_overflow.asp
> Another option is to put your control in an IFrame.
> http://msdn.microsoft.com/workshop/...://SteveOrr.net
>
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>
You may also find this useful. Freeze columns and rows
like Excel but in your html table:
http://www.eggheadcafe.com/articles...rol.asp

Robbe Morris - 2004/2005 Microsoft MVP C#
Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp
"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
>

table with a scrollbar?

I have a user control (HTML table) within a table. Would it be possible to
cause the user control to scroll its conents when its container is too
small, or will I just have to make its height = 100% so it can't cause its
container to resize too big?

PaulYou can put your table (or any control) into a fixed size area by putting it
in a scrollable div such as this:

<div id="Layer1" style="position:relative;width:350px;height:200px;overflo w:
scroll;">control goes here</div
The key is to use the "overflow" CSS attribute.Here's more info:
http://www.w3schools.com/css/pr_pos_overflow.asp

Another option is to put your control in an IFrame.
http://msdn.microsoft.com/workshop/...ects/IFRAME.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul
Thanks, that's exactly what I was looking for.

Paul

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:eI5ghT3oFHA.3912@.TK2MSFTNGP10.phx.gbl...
> You can put your table (or any control) into a fixed size area by putting
> it in a scrollable div such as this:
> <div id="Layer1"
> style="position:relative;width:350px;height:200px;overflo w:
> scroll;">control goes here</div>
> The key is to use the "overflow" CSS attribute.Here's more info:
> http://www.w3schools.com/css/pr_pos_overflow.asp
> Another option is to put your control in an IFrame.
> http://msdn.microsoft.com/workshop/...ects/IFRAME.asp
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
> "PJ6" <nobody@.nowhere.net> wrote in message
> news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>>I have a user control (HTML table) within a table. Would it be possible to
>>cause the user control to scroll its conents when its container is too
>>small, or will I just have to make its height = 100% so it can't cause its
>>container to resize too big?
>>
>> Paul
>>
You may also find this useful. Freeze columns and rows
like Excel but in your html table:

http://www.eggheadcafe.com/articles...ver_control.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"PJ6" <nobody@.nowhere.net> wrote in message
news:%23EMq6P3oFHA.3760@.TK2MSFTNGP15.phx.gbl...
>I have a user control (HTML table) within a table. Would it be possible to
>cause the user control to scroll its conents when its container is too
>small, or will I just have to make its height = 100% so it can't cause its
>container to resize too big?
> Paul

Wednesday, March 28, 2012

TableCell

I am using the TableCell object from the framework.
How can I mark a TableCell to correspond to a TH tag, when it gets converted
to a HTML table?
--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)Use a TableHeaderCell object instead.

"Arne Garvander" wrote:

> I am using the TableCell object from the framework.
> How can I mark a TableCell to correspond to a TH tag, when it gets converted
> to a HTML table?
> --
> Arne Garvander
> (I program VB.Net for fun and C# to get paid.)

TableCell

I am using the TableCell object from the framework.
How can I mark a TableCell to correspond to a TH tag, when it gets converted
to a HTML table?
--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)Use a TableHeaderCell object instead.
"Arne Garvander" wrote:

> I am using the TableCell object from the framework.
> How can I mark a TableCell to correspond to a TH tag, when it gets convert
ed
> to a HTML table?
> --
> Arne Garvander
> (I program VB.Net for fun and C# to get paid.)

TableCell: BackColor Property But No BackGround Property?

I am using an ASP:Table Control to make a table. I know that the HTML TD tag
has a background attribute and a bgcolor attribute. The TableCell has a
BackColor property, which is the equivelant of the HTML bgcolor attribute,
but what can I use as an equivelant for the HTML background attribute?
Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/I would have to look but my first thought is this. The control will render
whatever attribute you add. So you can add it declaratively with
attribute="value" syntax or on in the code you can add it through the
Attributes collection on the control.

C#
control.Attributes.Add("Name", "Value");

I think you can do this too, because I think it is a NameValueCollection
which means it handles the add automatically.
control.Attributes["Name"] = "Value";

"Nathan Sokalski" wrote:

> I am using an ASP:Table Control to make a table. I know that the HTML TD tag
> has a background attribute and a bgcolor attribute. The TableCell has a
> BackColor property, which is the equivelant of the HTML bgcolor attribute,
> but what can I use as an equivelant for the HTML background attribute?
> Thanks.
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>

TableRow Borders

Okay, I'm sure that this is an incredibly simple one and it may have more to
do with HTML than with ASP.NET:
I have an ASP:Table with no borders and that table has several ASP:TableRows
, each with several ASP:TableCells in them.
I have no trouble setting the BorderWidth, BorderStyle, etc. of the individu
al TableCells or even of the whole ASP:Table. But what if I want to set the
BorderStyle and BorderColor, etc. of one of the ASP:TableRows? When I do thi
s, I get no errors, but not
hing happens. The goal is to outline one of the rows of the table (a box aro
und the whole TableRow, not around each of the row's cells). These propertie
s of the TableRow object don't seem to do anything. Can you help? Do I need
to use styles? If so, how?
Thanks!
AlexHi Alex,
The BorderStyle on ASP:TableRow will be grant to the <tr> tag in client
browser. Hwoever, these styles didn't work with a <tr> tag.
Your idea for setting style of each cell is also great. Following are code
to achieve this:
Dim count As Integer
Table1.Rows(1).Cells(0).Attributes.Add("style", "BORDER-TOP: ridge;
BORDER-BOTTOM: ridge;BORDER-LEFT: ridge")
Table1.Rows(1).Cells(Table1.Rows(1).Cells.Count -
1).Attributes.Add("style", "BORDER-TOP: ridge; BORDER-BOTTOM:
ridge;BORDER-RIGHT: ridge")
For count = 1 To Table1.Rows(1).Cells.Count - 2
Table1.Rows(1).Cells(count).Attributes.Add("style",
"BORDER-TOP: ridge; BORDER-BOTTOM: ridge")
Next
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Two things:
1. If I set the borders of all of the cells in the Row, it has a different l
ook. What I really need is to be able to outline the whole row. Is there any
way to do that, maybe using styles for each of the cells so that I can edge
them as I want to? (e.g. o
nly the top and left side of a cell, etc.)?
Also, just out of curiosity, what's the point in having BorderStyle, etc. fo
r the TableRow class if it doesn't do anything?
Thanks.
Alex
-- [MSFT] wrote: --
Hi Alex,
An asp:TableRow will be rendered into <tr> tag by ASP.NET. An asp:table
will be rendered like:
<Table><tr><td>
..
</td></tr></Table>
The tag "<tr>" cannot have a border seperately. So do the asp:tablerow. I
think there are several work arounds for this problem:
1. set all cells' border in the row instead.
2. set the row's backgroud color instead. If you want to select/highlight a
row, it is also a good way.
Hope this help.
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

TableRow Borders

Okay, I'm sure that this is an incredibly simple one and it may have more to do with HTML than with ASP.NET

I have an ASP:Table with no borders and that table has several ASP:TableRows, each with several ASP:TableCells in them

I have no trouble setting the BorderWidth, BorderStyle, etc. of the individual TableCells or even of the whole ASP:Table. But what if I want to set the BorderStyle and BorderColor, etc. of one of the ASP:TableRows? When I do this, I get no errors, but nothing happens. The goal is to outline one of the rows of the table (a box around the whole TableRow, not around each of the row's cells). These properties of the TableRow object don't seem to do anything. Can you help? Do I need to use styles? If so, how

Thanks

AlexHi Alex,

An asp:TableRow will be rendered into <tr> tag by ASP.NET. An asp:table
will be rendered like:

<Table>
<tr>
<td>
...
</td>
</tr>
</Table
The tag "<tr>" cannot have a border seperately. So do the asp:tablerow. I
think there are several work arounds for this problem:

1. set all cells' border in the row instead.
2. set the row's backgroud color instead. If you want to select/highlight a
row, it is also a good way.

Hope this help.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Two things

1. If I set the borders of all of the cells in the Row, it has a different look. What I really need is to be able to outline the whole row. Is there any way to do that, maybe using styles for each of the cells so that I can edge them as I want to? (e.g. only the top and left side of a cell, etc.)

Also, just out of curiosity, what's the point in having BorderStyle, etc. for the TableRow class if it doesn't do anything

Thanks

Ale

-- [MSFT] wrote: --

Hi Alex

An asp:TableRow will be rendered into <tr> tag by ASP.NET. An asp:table
will be rendered like

<Table><tr><td
..
</td></tr></Table

The tag "<tr>" cannot have a border seperately. So do the asp:tablerow. I
think there are several work arounds for this problem

1. set all cells' border in the row instead
2. set the row's backgroud color instead. If you want to select/highlight a
row, it is also a good way

Hope this help

Luk
Microsoft Online Suppor

Get Secure! www.microsoft.com/securit
(This posting is provided "AS IS", with no warranties, and confers no
rights.
Hi Alex,

The BorderStyle on ASP:TableRow will be grant to the <tr> tag in client
browser. Hwoever, these styles didn't work with a <tr> tag.

Your idea for setting style of each cell is also great. Following are code
to achieve this:

Dim count As Integer

Table1.Rows(1).Cells(0).Attributes.Add("style", "BORDER-TOP: ridge;
BORDER-BOTTOM: ridge;BORDER-LEFT: ridge")

Table1.Rows(1).Cells(Table1.Rows(1).Cells.Count -
1).Attributes.Add("style", "BORDER-TOP: ridge; BORDER-BOTTOM:
ridge;BORDER-RIGHT: ridge")

For count = 1 To Table1.Rows(1).Cells.Count - 2

Table1.Rows(1).Cells(count).Attributes.Add("style",
"BORDER-TOP: ridge; BORDER-BOTTOM: ridge")

Next

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

TableRow/TableCell Serverside Q

Consider this pseudo HTML from a web form

<asp:Table>
<asp:TableRow>
<asp:TableCell>
<asp:Table>
<asp:TableRow>
<asp:TableCell></asp:TableCell>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:TableCell>
</asp:TableRow>
</asp:Table
How can I construct this on the server side? Assume that I start with an
empty asp:table control on my webform, as follows:

<asp:Table ID="tblViewWall" Runat="server"></asp:Table
I've done the following:

TableRow trRow = new TableRow();
TableCell trCell = new TableCell();
trRow.Cells.Add(trCell);

// Now inside trCell, I want to add another table with 1 row, and two
cells
// I can't see how I would create another Table, and add it to a
TableCell

tblViewWall.Rows.Add(trRow);Figured it out.
tcCell.Controls.Add( ...)

"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:#tWpeZ8oDHA.2456@.TK2MSFTNGP09.phx.gbl...
> Consider this pseudo HTML from a web form
> <asp:Table>
> <asp:TableRow>
> <asp:TableCell>
> <asp:Table>
> <asp:TableRow>
> <asp:TableCell></asp:TableCell>
> <asp:TableCell></asp:TableCell>
> </asp:TableRow>
> </asp:Table>
> </asp:TableCell>
> </asp:TableRow>
> </asp:Table>
> How can I construct this on the server side? Assume that I start with an
> empty asp:table control on my webform, as follows:
> <asp:Table ID="tblViewWall" Runat="server"></asp:Table>
> I've done the following:
> TableRow trRow = new TableRow();
> TableCell trCell = new TableCell();
> trRow.Cells.Add(trCell);
> // Now inside trCell, I want to add another table with 1 row, and two
> cells
> // I can't see how I would create another Table, and add it to a
> TableCell
> tblViewWall.Rows.Add(trRow);
George,

Try something like this:

TableCell newCell = new TableCell();
Table childTable = new Table();
newCell.Controls.Add(childTable);

//Populate the child table here.

TableRow newRow = new TableRow();
newRow.Cells.Add(newCell);

this.tblViewWall.Rows.Add(newRow);

HTH,
Nicole

"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:%23tWpeZ8oDHA.2456@.TK2MSFTNGP09.phx.gbl...
> Consider this pseudo HTML from a web form
> <asp:Table>
> <asp:TableRow>
> <asp:TableCell>
> <asp:Table>
> <asp:TableRow>
> <asp:TableCell></asp:TableCell>
> <asp:TableCell></asp:TableCell>
> </asp:TableRow>
> </asp:Table>
> </asp:TableCell>
> </asp:TableRow>
> </asp:Table>
> How can I construct this on the server side? Assume that I start with an
> empty asp:table control on my webform, as follows:
> <asp:Table ID="tblViewWall" Runat="server"></asp:Table>
> I've done the following:
> TableRow trRow = new TableRow();
> TableCell trCell = new TableCell();
> trRow.Cells.Add(trCell);
> // Now inside trCell, I want to add another table with 1 row, and two
> cells
> // I can't see how I would create another Table, and add it to a
> TableCell
> tblViewWall.Rows.Add(trRow);

Saturday, March 24, 2012

TabStrip or Tab Controls

I would like to place a tab control on an ASP Web Page. I
don't see a control that I can drag from the toolbox for
either "web forms" or "html" that I can use. Does anyone
know how to do this?There isn't one out of the box. You have to a) download the IE Web Controls
from http://www.asp.net/IEWebControls/Do...index=0&tabid=1, b)
add an association to the ie web controls dll to your project, then c)
manually add the tabstrip capability to the toolbox by customizing the
toolbar to display the items from the ie web controls dll.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Natasha" <ndicocco@.nauticom.net> wrote in message
news:0b6101c36822$81e3e9c0$a001280a@.phx.gbl...
> I would like to place a tab control on an ASP Web Page. I
> don't see a control that I can drag from the toolbox for
> either "web forms" or "html" that I can use. Does anyone
> know how to do this?

Thursday, March 22, 2012

Tags missing there end tags when they are there.

Ok I've got this real pain in the butt problem, I have copied and pasted much of my code from a template and I understand html, css, VB language pritty good, I have used my current page without problems using Visual Web Developer 2005 Express Edition for some time now....but today I've moved around a few tags located in a couple div tags and now when I try to switch to the design view from the code view a couple error's come up and tell me that 4 of my div tags are missing there end tags and 4 of my end tags are missing there div tags.........but they are all there, its just not reconizing them......how do I bind the end tag to the start tag when this happens, I've tried re-writing this bit of code which works but the next time I go into my code view and back to the design view the same error comes up...

Talk about a pain any help would be of great help...thank you.......also I know that somehow you can click a couple buttons to automaticlly arrange your code into the right format for instance this horrible messy code here

 "LoginView2" runat="server"> Welcome Back
"LoginName1" runat="server" style="left: 1px; top: 15px; z-index: 100;" Height="23px" /> "LoginStatus1" runat="server" Style="position: static" />
To this somewhat nicer code here.
 <asp:LoginView ID="LoginView2" runat="server"> <LoggedInTemplate> Welcome Back<br /> <asp:LoginName ID="LoginName1" runat="server" style="left: 1px; top: 15px; z-index: 100;" Height="23px" />    <asp:LoginStatus ID="LoginStatus1" runat="server" Style="position: static" /> </LoggedInTemplate> <AnonymousTemplate> <asp:Login ID="Login1" runat="server" BackColor="Bisque" BorderColor="#FF8000" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Bold="True" Font-Names="Palatino Linotype" Font-Size="1.3em" ForeColor="Black" Height="135px" Style="position: static" CreateUserText="Register" CreateUserUrl="~/Register.aspx" PasswordRecoveryText="Forgot Your Password?" PasswordRecoveryUrl="~/passwordRecovery.aspx"> <TitleTextStyle BackColor="#FF8000" Font-Bold="True" Font-Size="0.9em" ForeColor="White" /> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BackColor="#FF8000" BorderColor="#FF8000" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="White" /> <CheckBoxStyle BackColor="Transparent" /> <HyperLinkStyle ForeColor="RoyalBlue" /> </asp:Login> </AnonymousTemplate> </asp:LoginView>
if you know they way to do this please let me know that might be my problem things not lining up...

P.S. my code does not look like the first example LOL

Sorry everyone I just figured this whole thing out after working on it literally for the past 5 hours haha but if you want to learn about this problem and how to incorporate <form runat=server> Tags in a masterpage and use content pages that also run off that tag then go to my very last post located here.

http://forums.asp.net/thread/1379460.aspx

Thanks.

Take into a varible the HTML of a aspx page

Jacas,

You can use Response.Filter to do this. Here's an example:

using System;
using System.IO;

namespace cslocation
{
/// <summary>
/// Summary description for MyFilter.
/// </summary>
public class HTMLFilter : Stream
// This filter changes all characters passed through it to uppercase.
{
private Stream _sink;
private long _position;

public byte[] data;

public EmailFilter(Stream sink)
{
_sink = sink;
}

// The following members of Stream must be overriden.
public override bool CanRead
{
get { return true; }
}

public override bool CanSeek
{
get { return true; }
}

public override bool CanWrite
{
get { return true; }
}

public override long Length
{
get { return 0; }
}

public override long Position
{
get { return _position; }
set { _position = value; }
}

public override long Seek(long offset, System.IO.SeekOrigin direction)
{
return _sink.Seek(offset, direction);
}

public override void SetLength(long length)
{
_sink.SetLength(length);
}

public override void Close()
{
_sink.Close();
}

public override void Flush()
{
_sink.Flush();
}

public override int Read(byte[] buffer, int offset, int count)
{
return _sink.Read(buffer, offset, count);
}

// The Write method actually does the filtering.
public override void Write(byte[] buffer, int offset, int count)
{
data = new byte[count];
Buffer.BlockCopy(buffer, offset, data, 0, count);
_sink.Write (data, 0, count);
}

}

}

You can then instantiate this class as follows:

Response.Filter = new HTMLFilter(Response.Filter);

Hope that helps.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@dotnet.itags.org.online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

-------
>Content-Class: urn:content-classes:message
>From: "jacas" <anonymous@dotnet.itags.org.discussions.microsoft.com>
>Sender: "jacas" <anonymous@dotnet.itags.org.discussions.microsoft.com>
>Subject: Take into a varible the HTML of a aspx page
>Date: Thu, 23 Oct 2003 09:00:01 -0700
>Lines: 7
>Message-ID: <00db01c3997e$b6ed2630$a301280a@dotnet.itags.org.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcOZfrbt/w7LUNvpQrmKlBXOan6XQg==
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186086
>NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Somebody can expli-me how to take de the HTML of a aspx
>page into a string variable may be in de render or
>prerender event of a page
>
>thanksHy Jim,

I don't know if I don't understand but whith your code you
do a filter of the response but what I want is to take the
HTML an put it in a string varible... I do it from another
page like

you can get HtML froma a page like
mywebReq = WebRequest.Create("http://www.c-
sharpcorner.com/faq.asp")
mywebResp = mywebReq.GetResponse()
sr = New StreamReader(mywebResp.GetResponseStream,
System.Text.Encoding.ASCII)
strHTML = sr.ReadToEnd
TextBox1.Text = strHTML

but it has problems when the page is in de same directory
as de page in where de code is an in it you have to
athentificate if you want to wiev pages, but i thing it
might be a way of take that page if you are already
athentificate

i proof that
mywebReq = WebRequest.Create(site & "(" &
Request.ServerVariables("HTTP_ASPFILTERSESSIONID") & ")
page.aspx")

but d'ont works
and I thinkg there is a way for do that in the same page
that I want the HTML ...what i want is to take the
Response.content in a string variable like

str = Response.content (this is not possible but is for
expline what i want)

Thanks any way
Jacas,

I'm having a little trouble understanding exactly what you're saying, but
if I understand correctly, you want to get the HTML that is rendered by
ASP.NET and store it in a variable. If that's the case, Response.Filter is
the way to go and using the code I posted is what you want to use.

That code was originally written by one of my colleagues for a customer we
were working with who wanted to do the exact same thing you're doing. The
only difference is that our other customer was taking that HTML and
populating an e-mail message with it. You just want to store it. The end
result is the same. If you want to do it reliably, use Response.Filter.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@.online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

-------
>Content-Class: urn:content-classes:message
>From: "jacas" <anonymous@.discussions.microsoft.com>
>Sender: "jacas" <anonymous@.discussions.microsoft.com>
>References: <00db01c3997e$b6ed2630$a301280a@.phx.gbl>
<SDvxA3YmDHA.1544@.cpmsftngxa06.phx.gbl>
>Subject: RE: Take into a varible the HTML of a aspx page
>Date: Fri, 24 Oct 2003 01:48:25 -0700
>Lines: 38
>Message-ID: <0ae701c39a0b$9627e2e0$a101280a@.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcOaC5Yls6pRYc1aRouN+9Tsp3ecsA==
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186270
>NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Hy Jim,
>I don't know if I don't understand but whith your code you
>do a filter of the response but what I want is to take the
>HTML an put it in a string varible... I do it from another
>page like
>you can get HtML froma a page like
> mywebReq = WebRequest.Create("http://www.c-
>sharpcorner.com/faq.asp")
> mywebResp = mywebReq.GetResponse()
> sr = New StreamReader(mywebResp.GetResponseStream,
>System.Text.Encoding.ASCII)
> strHTML = sr.ReadToEnd
> TextBox1.Text = strHTML
>but it has problems when the page is in de same directory
>as de page in where de code is an in it you have to
>athentificate if you want to wiev pages, but i thing it
>might be a way of take that page if you are already
>athentificate
>i proof that
>mywebReq = WebRequest.Create(site & "(" &
>Request.ServerVariables("HTTP_ASPFILTERSESSIONID") & ")
>page.aspx")
>but d'ont works
>and I thinkg there is a way for do that in the same page
>that I want the HTML ...what i want is to take the
>Response.content in a string variable like
>str = Response.content (this is not possible but is for
>expline what i want)
>Thanks any way
I work with VB an i translate your code

Public Class HTMLFilter
Inherits Stream
Private _sink As Stream
Private _position As Long
Public data As Byte()

Public Sub EmailFilter(ByVal sink As Stream)
_sink = sink
End Sub
Overrides ReadOnly Property CanRead() As Boolean
Get
Return True
End Get
End Property

Overrides ReadOnly Property CanSeek() As Boolean
Get
Return True
End Get
End Property

Overrides ReadOnly Property CanWrite() As Boolean
Get
Return True
End Get
End Property
Overrides ReadOnly Property Length() As Long
Get
Return 0
End Get
End Property

Overrides Property Position() As Long
Get
Return _position
End Get
Set(ByVal Value As Long)
_position = Value
End Set
End Property

Public Overrides Function Seek(ByVal offset As
Long, ByVal direction As SeekOrigin) As Long
Return _sink.Seek(offset, direction)
End Function
Public Overrides Sub SetLength(ByVal length As
Long)
_sink.SetLength(length)
End Sub
Public Overrides Sub Close()
_sink.Close()
End Sub
Public Overrides Sub Flush()
_sink.Flush()
End Sub
Public Overloads Function Read(ByVal buffer() As
Byte, ByVal offset As Int16, ByVal count As Int16) As Int16
Return _sink.Read(buffer, offset, count)
End Function
Public Overloads Function Write(ByVal buffer() As
Byte, ByVal offset As Int16, ByVal count As Int16)
ReDim data(count)
System.Buffer.BlockCopy(buffer, offset, data,
0, count)
_sink.Write(data, 0, count)
End Function
End Class

but intelligence says to me that the class HTMLFilter must
either be declared 'MustInherit' or override the following
inherited 'MustOverride' members: Public Overridable
MustOverride Overloads Sub Write(buffer() As Byte, offset
As Integer, count As Integer), Public Overridable
MustOverride Overloads Function Read(buffer() As Byte,
offset As Integer, count As Integer) As Integer

but if I understand i do it... please if you can help me...
and if i understand the page is in de accesible punblic
data that is a byte() , sorry if it is very simple but how
i take it in a varible string , you say to instantiate the
class
Response.Filter= new HTMLFilter(Response.filter)

but how i can take the HTML in string (sorry because is
posible that i don't be a very good student) ;-)

Xavi
Xavi,

I can provide you with the sample, but if you need assistance in reworking
it for your application, you would need to open a case with us. That kind
of work goes beyond what we can do in the newsgroups.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@.online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

-------
>Content-Class: urn:content-classes:message
>From: <anonymous@.discussions.microsoft.com>
>Sender: <anonymous@.discussions.microsoft.com>
>References: <00db01c3997e$b6ed2630$a301280a@.phx.gbl>
<SDvxA3YmDHA.1544@.cpmsftngxa06.phx.gbl>
<0ae701c39a0b$9627e2e0$a101280a@.phx.gbl>
<VFH0lAkmDHA.1772@.cpmsftngxa06.phx.gbl>
>Subject: RE: Take into a varible the HTML of a aspx page
>Date: Mon, 27 Oct 2003 10:52:48 -0800
>Lines: 89
>Message-ID: <026201c39cbb$83f450b0$a301280a@.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Thread-Index: AcOcu4P0bnCG4ILqTTeyjwHdVOkP5A==
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186784
>NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>I work with VB an i translate your code
>Public Class HTMLFilter
> Inherits Stream
> Private _sink As Stream
> Private _position As Long
> Public data As Byte()
> Public Sub EmailFilter(ByVal sink As Stream)
> _sink = sink
> End Sub
> Overrides ReadOnly Property CanRead() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property CanSeek() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property CanWrite() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property Length() As Long
> Get
> Return 0
> End Get
> End Property
> Overrides Property Position() As Long
> Get
> Return _position
> End Get
> Set(ByVal Value As Long)
> _position = Value
> End Set
> End Property
> Public Overrides Function Seek(ByVal offset As
>Long, ByVal direction As SeekOrigin) As Long
> Return _sink.Seek(offset, direction)
> End Function
> Public Overrides Sub SetLength(ByVal length As
>Long)
> _sink.SetLength(length)
> End Sub
> Public Overrides Sub Close()
> _sink.Close()
> End Sub
> Public Overrides Sub Flush()
> _sink.Flush()
> End Sub
> Public Overloads Function Read(ByVal buffer() As
>Byte, ByVal offset As Int16, ByVal count As Int16) As Int16
> Return _sink.Read(buffer, offset, count)
> End Function
> Public Overloads Function Write(ByVal buffer() As
>Byte, ByVal offset As Int16, ByVal count As Int16)
> ReDim data(count)
> System.Buffer.BlockCopy(buffer, offset, data,
>0, count)
> _sink.Write(data, 0, count)
> End Function
> End Class
>but intelligence says to me that the class HTMLFilter must
>either be declared 'MustInherit' or override the following
>inherited 'MustOverride' members: Public Overridable
>MustOverride Overloads Sub Write(buffer() As Byte, offset
>As Integer, count As Integer), Public Overridable
>MustOverride Overloads Function Read(buffer() As Byte,
>offset As Integer, count As Integer) As Integer
>but if I understand i do it... please if you can help me...
>and if i understand the page is in de accesible punblic
>data that is a byte() , sorry if it is very simple but how
>i take it in a varible string , you say to instantiate the
>class
>Response.Filter= new HTMLFilter(Response.filter)
>but how i can take the HTML in string (sorry because is
>posible that i don't be a very good student) ;-)
>Xavi