944,093 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 12146
  • ASP.NET RSS
Jun 14th, 2006
0

Problem with javascript variable and hidden input

Expand Post »
Hi, all!

I've been trying to pass a javascript variable to an asp.net webapp through a hidden input field.
All according to post http://www.daniweb.com/techtalkforums/thread26184.html.

But something seems to be garbled.

Here's what parts of my aspx code looks like.

...
             var src = document.documentElement.outerHTML;
                   document.getElementById("pSource").Value = src;
               }
 </script>
</head>
<body>
<form runat="server">
      <input id="pSource" type="hidden" />
...
Somehow the line document.getElementById("pSource").Value = src; doesn't work.
I've tried with <input id="pSource" type="hidden" runat="server" /> as well.

The javascript code is in a window.onload function.
What I want to do is to have the content of the hidden field mailed as html from CodeBehind.

Any suggestions?
Similar Threads
Reputation Points: 87
Solved Threads: 128
Practically a Master Poster
Oxiegen is offline Offline
652 posts
since Jun 2006
Jun 15th, 2006
0

Re: Problem with javascript variable and hidden input

I solved it myself by expanding the coding Sathiya used in this thread: http://www.daniweb.com/techtalkforum...ad.php?t=45854

My solution was to use the RenderControl method in the Page class.
This gives me the entire entity of the rendered page as a string, which can then be used as body in a html-mail.
And this can be done without any hidden variables and javascript code.
Reputation Points: 87
Solved Threads: 128
Practically a Master Poster
Oxiegen is offline Offline
652 posts
since Jun 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: IFrame
Next Thread in ASP.NET Forum Timeline: Email Web Page Content





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC