asp:LinkButton

  • Thread starter Thread starter Brian
  • Start date Start date
B

Brian

I have a page that contains an asp:LinkButton. The purpose of this button
is to allow the user to send the current page as an email. My "plan" was
to, in the click event handler of the LinkButton, store the html source for
the current page in the viewstate and take the user to another page where
they can type in the email address they would like the page sent to. I
guess my question is:

1) Is this the best way to do it?
2) How in the world do I access the HTML for the current page from code
behind?

TIA

Brian
 
Brian said:
I have a page that contains an asp:LinkButton. The purpose of this button
is to allow the user to send the current page as an email. My "plan" was
to, in the click event handler of the LinkButton, store the html source for
the current page in the viewstate and take the user to another page where
they can type in the email address they would like the page sent to. I
guess my question is:

1) Is this the best way to do it?
2) How in the world do I access the HTML for the current page from code
behind?

Usually, this is done with the RenderControl() function, which can render a
control (or even a page) on any "surface", also in a mail.

But this would require you to reproduce the same content in a kind of user
control, keeping state in the process.

I would suggest sending the mail in the same page, that would be much
easier.
Try to move the content for the mail to a user control, that you can re-use
both in the page and in the mail.

Group the controls for sending the mail in a panel that you can show and
hide if you need to.

Riki
 
Back
Top