Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR
run an aspx page and capture the output as a string and then write this out
to a page....
So for example say you have a page that takes an id number as a query string
and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200,
id=300 etc and on each loop capture the output as a string and then
response.write it out on the page this script was being executed, the end
result would be the page shown over and over again one after the other but
as if each had been run with a different id number? 8 1888
Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you
haven't described the requirement. The solution is always based first upon
the requirement (in purely abstract terms), and upon the available resources
for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one
another, you're talking about a solution. The requirement would be more
along the lines of "I want to display a variable number of database records
on a page," or "I want to display one record on a page, and have a link to
the next page." It might include such requirements as "The page body should
look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might
want to embed the output of one ASPX Page inside another, and you can use
Server.Transfer to accomplish this, but these situations are relatively
rare. Most of the time, Server Controls are used for this sort of thing.
Without knowing your requirements, it isn't possible to advise you as to the
correct solution.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message
news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do
that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its
difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders
2) For each it found it then retrieved the sub parts of that order, e.g. tin
of beans £10, tin of tuna £5 etc
3) It then wrote this out building the complete page on the fly in a table,
putting in the company logo, address, delivery address....made the invoice
basically.
4) Once the first invoice is done I then created a page break (using CSS) to
force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page,
then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in
asp.net. I now have some new stationary, paper with a peel off label
attached.
So i now need the exact same thing achieved but with the exact position of
the delivery address to match with the label, in .net using absolute
positioning and the lovely interface this didnt take long and so i have
created my .net page to take an order id and create my invoice with
everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second
invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original
asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on
the fly for the second invoice and placing this one on a new page using my
css break to break them apart on a new page. Problem is i dont seem to be
able to get the panel position programatically in order to do this. (i also
dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and
embed the output of the single page that does work, changing the querystring
to each order id.....i agree it is very inefficient but it would work. Then
i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
Sounds like a job for usercontrols. You can create a usercontrol that has
all the elements necessary to render one particular invoice. Then on the
main page, you can have all your main elements such as the header and so on
(possible include like a placeholder or something for later use like a
<div>). When the main page is processed, you would then loop through all
your IDs and dynamically load each user control providing it just enough
information to render itself using the LoadControl method. You would then
add this newly loaded control to the Control collection of your placeholder.
"Daniel" <Da*****@vestryonline.com> wrote in message
news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
To fix positing, you might need to resort to using tables to help you layout
your content. I assume that you were trying to position the panel using
CSS. Set the width and height for the table cells will allow you to
position elements you necessary with some precision.
"Daniel" <Da*****@vestryonline.com> wrote in message
news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
Hi Daniel,
Sounds like a Repeater Control to me. Have you looked into it?
The issue here is that an ASP.Net page is designed to render an entire HTML
document. While it can do otherwise, Server Controls are specifically
designed to render HTML *in* HTML documents. So, a Repeater Control will
render the same HTML over an over again, which it sounds like you want to
do.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message
news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
Hi Kevin/Peter
Peter - User controls sounds ideal not sure how to sort the new page issue
with it tho, i could look into a way of padding it. So if i understand you
right i make a control that draws the invoice and take a var of orderid,
then just keep making new instances one after the other for each order id?
Sounds like a good solution
Kevin - Yes i had looked at repeaters but I have never used them before and
was not sure if they can handle absolutely positioned items, if i understand
right a repeater needs a template given to it, so i woul dhave to pass in my
full structure of my table layout but use the databinder.eval where the vars
would go. Is that right? If you can provide some sample code on a very basic
repeater that would help.
Either way thanks a million for both your responses.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl... Hi Daniel,
Sounds like a Repeater Control to me. Have you looked into it?
The issue here is that an ASP.Net page is designed to render an entire HTML document. While it can do otherwise, Server Controls are specifically designed to render HTML *in* HTML documents. So, a Repeater Control will render the same HTML over an over again, which it sounds like you want to do.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... Hi,
Does anyone know if it is possible to put an aspx page inside of another? OR run an aspx page and capture the output as a string and then write this out to a page....
So for example say you have a page that takes an id number as a query string and displays different things based on that id number.
If you were able to loop through running the aspx pages with id=100, id=200, id=300 etc and on each loop capture the output as a string and then response.write it out on the page this script was being executed, the end result would be the page shown over and over again one after the other but as if each had been run with a different id number?
Hi Daniel, Kevin - Yes i had looked at repeaters but I have never used them before and was not sure if they can handle absolutely positioned items, if i understand right a repeater needs a template given to it, so i woul dhave to pass in my full structure of my table layout but use the databinder.eval where the vars would go. Is that right? If you can provide some sample code on a very basic repeater that would help.
A Repeater will repeat whatever HTML is inside it, and whatever HTML is
rendered by Controls inside it. Looking at the ASP.Net object model, an
ASP.Net Page is an HttpHandler, which is also a Templated Control, and a
container for a WebForm, and/or other .Net Server Controls. Note that it is
also a Control. A Control renders HTML to an HttpHandler's
Response.OutputStream. So, you have 2 diffferent classes of Controls here.
One handles an HTTP Request. Both write HTML to an HttpHandler's
Response.OutputStream. You only need one HTTP Handler to handle a Request.
There is only one Response, and that belongs to the HttpHandler.
Let's take a look at your initial (ASP) solution to your requirements: 1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So, breaking this down abstractly into a set of requirements, you have a
requirement to create a single HTML document that prints out as multiple
printer documents. You're fetching data from a database and populating an
HTML table with the data.
According to your OP, you're not building more than one page. You're adding
HTML blocks to a single web page, and using CSS page breaks to break it up
when printing, correct?
It is important to note that, while ASP.Net uses a fully-object-oriented and
highly-structured object model, under the hood, ASP and ASP.Net both do the
same thing: They handle HTTP Requests, perform server-side processing, and
render HTML to the Response object's output stream, which is a file stream.
I may be wrong here, but I think I detect a bit of confusion between the
word "page" in the context of a web page rendered by ASP or ASP.Net, and
"page" in the context of printing. It is important to distinguish between
them. A single HTML web page can (and often does) print out to many pages on
a printer. Forgive me if I'm wrong about your understanding regarding this.
Okay, so, how does the web page control where the printer pages break? Well,
there are 2 options: If no CSS page breaks are used, the printer will create
page breaks at points in the page where the remaining content does not fit
in the printed page, whatever its dimensions are. The printer knows the
dimensions of the printable page, and the dimensions of the web page, and
simply cuts it up wherever it happens to break. If CSS page breaks are used,
the printer will break and create a new page whenever it encounters one of
these breaks. Also, if the content between the CSS breaks is longer than the
printable area, the printer will chop this up too. So, if we want full
control over the pagination, we need to ensure that the HTML content between
the page breaks is smaller than the printable page size.
Putting it all together, you want to create a single HTML document from
multiple database records. This single HTML document will repeatedly render
HTML blocks that are smaller than the printable target area, and put CSS
Page breaks between them.
So, note that we haven't talked about having to render more than one ASP.Net
page; only that we need to break it up into repeating blocks, one for each
database record.
This is exactly what a Repeater Control does. It is like an "embedded"
template in a Page. The Repeater Template is databound to data in a data
source, such as a DataSet or DataTable. It will repeat its functional output
once per item in the data source. This could include style information, as
well as CSS Page breaks, in addition to the content of each invoice. Here
are some excellent references regarding Repeaters, using Templated Controls,
and DataBinding Expressions: http://msdn.microsoft.com/library/de...vercontrol.asp http://msdn.microsoft.com/library/de...edcontrols.asp http://msdn.microsoft.com/library/de...evaltopic1.asp
As for your absolute positioning (thought I'd forgot?), There is no doubt a
CSS solution to your positioning problem. However, using absolute
positioning is not likely to be the solution. It may involve the judicious
use of HTML tables, with perhaps some relative positioning of the tables
themselves. The table can be used to keep everything inside it aligned
relatively within the table, and then use relative positioning to position
itself relative to the printed page (left, right, top, bottom).
BTW, you could also combine the use of a Repeater with a User Control in it,
as Peter suggested. The User Control would contain all the content you want
repeated, and be data-bound to each individual record via data binding. This
may not be necessary, depending upon your overall requirements
(extensibility, for example).
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message
news:eh*************@TK2MSFTNGP10.phx.gbl... Hi Kevin/Peter
Peter - User controls sounds ideal not sure how to sort the new page issue with it tho, i could look into a way of padding it. So if i understand you right i make a control that draws the invoice and take a var of orderid, then just keep making new instances one after the other for each order id? Sounds like a good solution
Kevin - Yes i had looked at repeaters but I have never used them before and was not sure if they can handle absolutely positioned items, if i understand right a repeater needs a template given to it, so i woul dhave to pass in my full structure of my table layout but use the databinder.eval where the vars would go. Is that right? If you can provide some sample code on a very basic repeater that would help.
Either way thanks a million for both your responses. "Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:OH**************@TK2MSFTNGP09.phx.gbl... Hi Daniel,
Sounds like a Repeater Control to me. Have you looked into it?
The issue here is that an ASP.Net page is designed to render an entire HTML document. While it can do otherwise, Server Controls are specifically designed to render HTML *in* HTML documents. So, a Repeater Control will render the same HTML over an over again, which it sounds like you want to do.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
I think you need to back up a bit. You're talking about a solution, but you haven't described the requirement. The solution is always based first upon the requirement (in purely abstract terms), and upon the available resources for satisfying the requirement.
The difference is that when you talk about puttting ASPX pages inside one another, you're talking about a solution. The requirement would be more along the lines of "I want to display a variable number of database records on a page," or "I want to display one record on a page, and have a link to the next page." It might include such requirements as "The page body should look the same."
An ASPX Page is an HTTP Handler. There are situations in which you might want to embed the output of one ASPX Page inside another, and you can use Server.Transfer to accomplish this, but these situations are relatively rare. Most of the time, Server Controls are used for this sort of thing. Without knowing your requirements, it isn't possible to advise you as to the correct solution.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:ui**************@TK2MSFTNGP10.phx.gbl... > Hi, > > Does anyone know if it is possible to put an aspx page inside of > another? OR run an aspx page and capture the output as a string and > then write this out to a page.... > > So for example say you have a page that takes an id number as a query > string and displays different things based on that id number. > > If you were able to loop through running the aspx pages with id=100, > id=200, id=300 etc and on each loop capture the output as a string and > then response.write it out on the page this script was being executed, > the end result would be the page shown over and over again one after > the other but as if each had been run with a different id number? > > > >
Hi Kevin,
A bit more detailed than i needed but it helped my understanding of the
repeater, and yes i did know the difference between a web page and a
printable page.
my original in asp i made by looping through the number of records and on
each building the table, filling in the data and then breaking the page with
css pagebreak.
it would seem the repeater does exactly this for you as you dont need to add
the loop just bind it.
Anyway i wanted to do it without the need to table it all, so keeping my
position absolute because it is so easy and quick in the design view to
position things.
Anyhow i took your advice and put my old asp fomrat into the repeater and it
works a treat.
Thanks for taking the time to reply so detailed, it really helped me
understand the repeater control.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u0**************@TK2MSFTNGP12.phx.gbl... Hi Daniel,
Kevin - Yes i had looked at repeaters but I have never used them before and was not sure if they can handle absolutely positioned items, if i understand right a repeater needs a template given to it, so i woul dhave to pass in my full structure of my table layout but use the databinder.eval where the vars would go. Is that right? If you can provide some sample code on a very basic repeater that would help.
A Repeater will repeat whatever HTML is inside it, and whatever HTML is rendered by Controls inside it. Looking at the ASP.Net object model, an ASP.Net Page is an HttpHandler, which is also a Templated Control, and a container for a WebForm, and/or other .Net Server Controls. Note that it is also a Control. A Control renders HTML to an HttpHandler's Response.OutputStream. So, you have 2 diffferent classes of Controls here. One handles an HTTP Request. Both write HTML to an HttpHandler's Response.OutputStream. You only need one HTTP Handler to handle a Request. There is only one Response, and that belongs to the HttpHandler.
Let's take a look at your initial (ASP) solution to your requirements:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So, breaking this down abstractly into a set of requirements, you have a requirement to create a single HTML document that prints out as multiple printer documents. You're fetching data from a database and populating an HTML table with the data. According to your OP, you're not building more than one page. You're adding HTML blocks to a single web page, and using CSS page breaks to break it up when printing, correct?
It is important to note that, while ASP.Net uses a fully-object-oriented and highly-structured object model, under the hood, ASP and ASP.Net both do the same thing: They handle HTTP Requests, perform server-side processing, and render HTML to the Response object's output stream, which is a file stream.
I may be wrong here, but I think I detect a bit of confusion between the word "page" in the context of a web page rendered by ASP or ASP.Net, and "page" in the context of printing. It is important to distinguish between them. A single HTML web page can (and often does) print out to many pages on a printer. Forgive me if I'm wrong about your understanding regarding this.
Okay, so, how does the web page control where the printer pages break? Well, there are 2 options: If no CSS page breaks are used, the printer will create page breaks at points in the page where the remaining content does not fit in the printed page, whatever its dimensions are. The printer knows the dimensions of the printable page, and the dimensions of the web page, and simply cuts it up wherever it happens to break. If CSS page breaks are used, the printer will break and create a new page whenever it encounters one of these breaks. Also, if the content between the CSS breaks is longer than the printable area, the printer will chop this up too. So, if we want full control over the pagination, we need to ensure that the HTML content between the page breaks is smaller than the printable page size.
Putting it all together, you want to create a single HTML document from multiple database records. This single HTML document will repeatedly render HTML blocks that are smaller than the printable target area, and put CSS Page breaks between them.
So, note that we haven't talked about having to render more than one ASP.Net page; only that we need to break it up into repeating blocks, one for each database record.
This is exactly what a Repeater Control does. It is like an "embedded" template in a Page. The Repeater Template is databound to data in a data source, such as a DataSet or DataTable. It will repeat its functional output once per item in the data source. This could include style information, as well as CSS Page breaks, in addition to the content of each invoice. Here are some excellent references regarding Repeaters, using Templated Controls, and DataBinding Expressions:
http://msdn.microsoft.com/library/de...vercontrol.asp http://msdn.microsoft.com/library/de...edcontrols.asp http://msdn.microsoft.com/library/de...evaltopic1.asp
As for your absolute positioning (thought I'd forgot?), There is no doubt a CSS solution to your positioning problem. However, using absolute positioning is not likely to be the solution. It may involve the judicious use of HTML tables, with perhaps some relative positioning of the tables themselves. The table can be used to keep everything inside it aligned relatively within the table, and then use relative positioning to position itself relative to the printed page (left, right, top, bottom).
BTW, you could also combine the use of a Repeater with a User Control in it, as Peter suggested. The User Control would contain all the content you want repeated, and be data-bound to each individual record via data binding. This may not be necessary, depending upon your overall requirements (extensibility, for example).
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:eh*************@TK2MSFTNGP10.phx.gbl... Hi Kevin/Peter
Peter - User controls sounds ideal not sure how to sort the new page issue with it tho, i could look into a way of padding it. So if i understand you right i make a control that draws the invoice and take a var of orderid, then just keep making new instances one after the other for each order id? Sounds like a good solution
Kevin - Yes i had looked at repeaters but I have never used them before and was not sure if they can handle absolutely positioned items, if i understand right a repeater needs a template given to it, so i woul dhave to pass in my full structure of my table layout but use the databinder.eval where the vars would go. Is that right? If you can provide some sample code on a very basic repeater that would help.
Either way thanks a million for both your responses. "Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:OH**************@TK2MSFTNGP09.phx.gbl... Hi Daniel,
Sounds like a Repeater Control to me. Have you looked into it?
The issue here is that an ASP.Net page is designed to render an entire HTML document. While it can do otherwise, Server Controls are specifically designed to render HTML *in* HTML documents. So, a Repeater Control will render the same HTML over an over again, which it sounds like you want to do.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer You can lead a fish to a bicycle, but it takes a very long time, and the bicycle has to *want* to change.
"Daniel" <Da*****@vestryonline.com> wrote in message news:eS*************@TK2MSFTNGP11.phx.gbl... Hi Kevin,
Thank you for replying. A very long way of saying 'why do you want to do that' but i will explain :)
I have posted this elsewhere in detail and had a few replies but its difficult to explain so i will try again here.
I have made an invoice in old asp a while ago. It did the following:
1) looped through the database retrieving all the orderids of open orders 2) For each it found it then retrieved the sub parts of that order, e.g. tin of beans £10, tin of tuna £5 etc 3) It then wrote this out building the complete page on the fly in a table, putting in the company logo, address, delivery address....made the invoice basically. 4) Once the first invoice is done I then created a page break (using CSS) to force a new page and write the next invoice etc
So once finished i had a load of invoices one after the other in a web page, then i press print and out they come ready for dispatch.
With that in mind i now want to update that page to do the same task in asp.net. I now have some new stationary, paper with a peel off label attached.
So i now need the exact same thing achieved but with the exact position of the delivery address to match with the label, in .net using absolute positioning and the lovely interface this didnt take long and so i have created my .net page to take an order id and create my invoice with everything where it should be.
All make sense so far?
My problem is as with my original, i want it to now move onto the second invoice, create a new page, and repeat....then to the net and so on.
I want to avoid making a page that writes out html tags like my original asp page and builds the tables on the fly.
So i have looked at putting it all in a panel and then making a new panel on the fly for the second invoice and placing this one on a new page using my css break to break them apart on a new page. Problem is i dont seem to be able to get the panel position programatically in order to do this. (i also dont even know if that is a viable solution)
Another option which i was checking with my original question was to run and embed the output of the single page that does work, changing the querystring to each order id.....i agree it is very inefficient but it would work. Then i could put my css page break between each output stream.
I hope that all makes sense, if you can help i would be very grateful
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:ex*************@TK2MSFTNGP12.phx.gbl... > Hi Daniel, > > I think you need to back up a bit. You're talking about a solution, > but you haven't described the requirement. The solution is always > based first upon the requirement (in purely abstract terms), and upon > the available resources for satisfying the requirement. > > The difference is that when you talk about puttting ASPX pages inside > one another, you're talking about a solution. The requirement would be > more along the lines of "I want to display a variable number of > database records on a page," or "I want to display one record on a > page, and have a link to the next page." It might include such > requirements as "The page body should look the same." > > An ASPX Page is an HTTP Handler. There are situations in which you > might want to embed the output of one ASPX Page inside another, and > you can use Server.Transfer to accomplish this, but these situations > are relatively rare. Most of the time, Server Controls are used for > this sort of thing. Without knowing your requirements, it isn't > possible to advise you as to the correct solution. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > .Net Developer > You can lead a fish to a bicycle, > but it takes a very long time, > and the bicycle has to *want* to change. > > "Daniel" <Da*****@vestryonline.com> wrote in message > news:ui**************@TK2MSFTNGP10.phx.gbl... >> Hi, >> >> Does anyone know if it is possible to put an aspx page inside of >> another? OR run an aspx page and capture the output as a string and >> then write this out to a page.... >> >> So for example say you have a page that takes an id number as a query >> string and displays different things based on that id number. >> >> If you were able to loop through running the aspx pages with id=100, >> id=200, id=300 etc and on each loop capture the output as a string >> and then response.write it out on the page this script was being >> executed, the end result would be the page shown over and over again >> one after the other but as if each had been run with a different id >> number? >> >> >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Julia Briggs |
last post by:
I am struggling to create a PHP function that would take a specified
image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail
so it will always fit in a 200x250 space. I am hoping...
|
by: rbt |
last post by:
Say I have a list that has 3 letters in it:
I want to print all the possible 4 digit combinations of those 3
letters:
4^3 = 64
aaaa
|
by: CHIN |
last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i
cant find the solution !! )
I have to upload a file to an external site, so, i made a .vbs file , that
logins to...
|
by: Andrzej |
last post by:
Is it possible to call a function which name is given by a string?
Let assume that I created a program which call some functions for example
void f1(void),
void f2(void),
void f3(void).
...
|
by: Bhupesh Naik |
last post by:
This is a query regarding my problem to make a spell and
grammar check possible in text area of a web page.
We have aspx pages which are used to construct letters.
The browser based screens...
|
by: AAA |
last post by:
hi,
I'll explain fastly the program that i'm doing..
the computer asks me to enter the cardinal of a set X ( called "dimX"
type integer)where X is a table of one dimension
and then to fill it...
|
by: Piotr Nowak |
last post by:
Hi,
Say i have a server process which listens for some changes in database.
When a change occurs i want to refresh my page in browser by notyfinig it.
I do not want to refresh my page i.e....
|
by: RSH |
last post by:
Okay my math skills aren't waht they used to be...
With that being said what Im trying to do is create a matrix that given x
number of columns, and y number of possible values i want to generate...
|
by: Robert S. |
last post by:
Searching some time now for documents on this but still did not find
anything about it:
Is it possible to replace the entry screen of MS Office Access 2007 -
that one presenting that default...
|
by: bjorklund.emil |
last post by:
Hello pythonistas.
I'm a newbie to pretty much both programming and Python. I have a task
that involves writing a test script for every possible combination of
preference settings for a software...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |