Problem with javascript variable and hidden input

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2006
Posts: 45
Reputation: Oxiegen is an unknown quantity at this point 
Solved Threads: 3
Oxiegen Oxiegen is offline Offline
Light Poster

Problem with javascript variable and hidden input

 
0
  #1
Jun 14th, 2006
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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 45
Reputation: Oxiegen is an unknown quantity at this point 
Solved Threads: 3
Oxiegen Oxiegen is offline Offline
Light Poster

Re: Problem with javascript variable and hidden input

 
0
  #2
Jun 15th, 2006
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC