By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,492 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,492 IT Pros & Developers. It's quick & easy.

Email contents of page

P: n/a
I want to be able to put into the body of an email, the entire contents of a
aspx page....with form fields filled out

I know I could go through and get the values of all of the textboxes, radio
button lists, etc, and format the body of my email, but it would be very
convenient if I could just have the email contain exactly what the page looks
like because the page is quite large.

I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
work, and I can get the page's rendered HTML into a StringBuilder variable,
but when the page posts back I get a "Page can only have one form runat
server....error.

So can this be done??

Thanks in advance!
John Scott.
Sep 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi John,

Does the page work if you don't email it? I'd imagine it doesn't. You
probably have 2 forms on the page which ASPX can't handle.

Just my 2 pence,
Jan

Sep 12 '05 #2

P: n/a
The page loads fine and I can fill out all the form values...the problem
exists when I click on a "Email Form" button....that's when the RenderControl
method is called and when the page posts back it acutally has two form tags
in the posted data.

--
Thanks,

John Scott.
"Jan Bannister" wrote:
Hi John,

Does the page work if you don't email it? I'd imagine it doesn't. You
probably have 2 forms on the page which ASPX can't handle.

Just my 2 pence,
Jan

Sep 12 '05 #3

P: n/a
Hi John,

Do not let the page post back. After you call RenderControl, redirect the
page to another page. You should not invoke RenderControl twice.

I believe this should work.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I want to be able to put into the body of an email, the entire contents of a
aspx page....with form fields filled out

I know I could go through and get the values of all of the textboxes, radio
button lists, etc, and format the body of my email, but it would be very
convenient if I could just have the email contain exactly what the page looks
like because the page is quite large.

I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
work, and I can get the page's rendered HTML into a StringBuilder variable,
but when the page posts back I get a "Page can only have one form runat
server....error.

So can this be done??

Thanks in advance!
John Scott.

Sep 12 '05 #4

P: n/a
I don't want to redirect to a different page, because I want to be able give
the user the ability to print the page either before OR after emailing the
form....

Redirecting would be the easy way out...but it won't work for me in the case.
--
Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

Do not let the page post back. After you call RenderControl, redirect the
page to another page. You should not invoke RenderControl twice.

I believe this should work.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I want to be able to put into the body of an email, the entire contents of a
aspx page....with form fields filled out

I know I could go through and get the values of all of the textboxes, radio
button lists, etc, and format the body of my email, but it would be very
convenient if I could just have the email contain exactly what the page looks
like because the page is quite large.

I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
work, and I can get the page's rendered HTML into a StringBuilder variable,
but when the page posts back I get a "Page can only have one form runat
server....error.

So can this be done??

Thanks in advance!
John Scott.

Sep 12 '05 #5

P: n/a
Hi John,

One question - why do you want to do a post back for printing? You could
handle this at the client side itself right?

This would make printing an independent task, which would also do away with
the RenderControl issue.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I don't want to redirect to a different page, because I want to be able give
the user the ability to print the page either before OR after emailing the
form....

Redirecting would be the easy way out...but it won't work for me in the case.
--
Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

Do not let the page post back. After you call RenderControl, redirect the
page to another page. You should not invoke RenderControl twice.

I believe this should work.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I want to be able to put into the body of an email, the entire contents of a
aspx page....with form fields filled out

I know I could go through and get the values of all of the textboxes, radio
button lists, etc, and format the body of my email, but it would be very
convenient if I could just have the email contain exactly what the page looks
like because the page is quite large.

I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
work, and I can get the page's rendered HTML into a StringBuilder variable,
but when the page posts back I get a "Page can only have one form runat
server....error.

So can this be done??

Thanks in advance!
John Scott.

Sep 12 '05 #6

P: n/a
The printing is actually done on the client-side...

The ideal situation is to allow the user to print out what ever they have
filled out...as well as be able to email the contents of the page....it
shouldn't matter to them which order they do it.

Does that make sense??

Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

One question - why do you want to do a post back for printing? You could
handle this at the client side itself right?

This would make printing an independent task, which would also do away with
the RenderControl issue.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I don't want to redirect to a different page, because I want to be able give
the user the ability to print the page either before OR after emailing the
form....

Redirecting would be the easy way out...but it won't work for me in the case.
--
Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

Do not let the page post back. After you call RenderControl, redirect the
page to another page. You should not invoke RenderControl twice.

I believe this should work.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:

> I want to be able to put into the body of an email, the entire contents of a
> aspx page....with form fields filled out
>
> I know I could go through and get the values of all of the textboxes, radio
> button lists, etc, and format the body of my email, but it would be very
> convenient if I could just have the email contain exactly what the page looks
> like because the page is quite large.
>
> I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
> work, and I can get the page's rendered HTML into a StringBuilder variable,
> but when the page posts back I get a "Page can only have one form runat
> server....error.
>
> So can this be done??
>
> Thanks in advance!
>
>
> John Scott.

Sep 12 '05 #7

P: n/a
Hmm...that is true.

The issue is you need to get the rendered contents (with user input) at the
server side, and re-display the same page so that the user may print it. This
is so that the user may do either printing or e-mailing in any order.

If you had somehow made printing always before e-mailing, then it could have
been simpler.

I am not getting any solutions to satisfy both requirements rt now :(. Let
me think it over...

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
The printing is actually done on the client-side...

The ideal situation is to allow the user to print out what ever they have
filled out...as well as be able to email the contents of the page....it
shouldn't matter to them which order they do it.

Does that make sense??

Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

One question - why do you want to do a post back for printing? You could
handle this at the client side itself right?

This would make printing an independent task, which would also do away with
the RenderControl issue.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
I don't want to redirect to a different page, because I want to be able give
the user the ability to print the page either before OR after emailing the
form....

Redirecting would be the easy way out...but it won't work for me in the case.
--
Thanks,

John Scott.
"Rakesh Rajan" wrote:

> Hi John,
>
> Do not let the page post back. After you call RenderControl, redirect the
> page to another page. You should not invoke RenderControl twice.
>
> I believe this should work.
>
> --
> HTH,
> Rakesh Rajan
> MVP, MCSD
> http://www.msmvps.com/rakeshrajan/
>
>
>
> "John Scott" wrote:
>
> > I want to be able to put into the body of an email, the entire contents of a
> > aspx page....with form fields filled out
> >
> > I know I could go through and get the values of all of the textboxes, radio
> > button lists, etc, and format the body of my email, but it would be very
> > convenient if I could just have the email contain exactly what the page looks
> > like because the page is quite large.
> >
> > I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
> > work, and I can get the page's rendered HTML into a StringBuilder variable,
> > but when the page posts back I get a "Page can only have one form runat
> > server....error.
> >
> > So can this be done??
> >
> > Thanks in advance!
> >
> >
> > John Scott.

Sep 12 '05 #8

P: n/a
That's exactly what I need...I also thought that in a worst-case scenario I
could just make an alert box pop up letting the user know that they need to
print the form before submitting it...kind of a lame solution, but it would
make things a lot easer. Please let me know if you have any other ideas.

Thank you for your quick reponses too!!

--
Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hmm...that is true.

The issue is you need to get the rendered contents (with user input) at the
server side, and re-display the same page so that the user may print it. This
is so that the user may do either printing or e-mailing in any order.

If you had somehow made printing always before e-mailing, then it could have
been simpler.

I am not getting any solutions to satisfy both requirements rt now :(. Let
me think it over...

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:
The printing is actually done on the client-side...

The ideal situation is to allow the user to print out what ever they have
filled out...as well as be able to email the contents of the page....it
shouldn't matter to them which order they do it.

Does that make sense??

Thanks,

John Scott.
"Rakesh Rajan" wrote:
Hi John,

One question - why do you want to do a post back for printing? You could
handle this at the client side itself right?

This would make printing an independent task, which would also do away with
the RenderControl issue.

--
HTH,
Rakesh Rajan
MVP, MCSD
http://www.msmvps.com/rakeshrajan/

"John Scott" wrote:

> I don't want to redirect to a different page, because I want to be able give
> the user the ability to print the page either before OR after emailing the
> form....
>
> Redirecting would be the easy way out...but it won't work for me in the case.
> --
> Thanks,
>
> John Scott.
>
>
> "Rakesh Rajan" wrote:
>
> > Hi John,
> >
> > Do not let the page post back. After you call RenderControl, redirect the
> > page to another page. You should not invoke RenderControl twice.
> >
> > I believe this should work.
> >
> > --
> > HTH,
> > Rakesh Rajan
> > MVP, MCSD
> > http://www.msmvps.com/rakeshrajan/
> >
> >
> >
> > "John Scott" wrote:
> >
> > > I want to be able to put into the body of an email, the entire contents of a
> > > aspx page....with form fields filled out
> > >
> > > I know I could go through and get the values of all of the textboxes, radio
> > > button lists, etc, and format the body of my email, but it would be very
> > > convenient if I could just have the email contain exactly what the page looks
> > > like because the page is quite large.
> > >
> > > I've tried to do a Page.RenderControl(htmlTextWriter); ...this does acutally
> > > work, and I can get the page's rendered HTML into a StringBuilder variable,
> > > but when the page posts back I get a "Page can only have one form runat
> > > server....error.
> > >
> > > So can this be done??
> > >
> > > Thanks in advance!
> > >
> > >
> > > John Scott.

Sep 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.