Note that there are some explanatory texts on larger screens.

plurals
  1. POValues not getting passed from javascript to codebehind asp.net?
    primarykey
    data
    text
    <pre><code> &lt;div class="row"&gt; &lt;label for="email"&gt;E-mail Address&lt;/label&gt; &lt;div class="col"&gt; &lt;div class="text"&gt;&lt;asp:TextBox ID="TextBox2" runat="server" onchange="javascript:updateHiddenField();"&gt;&lt;/asp:TextBox&gt;&lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt; &lt;/div&gt; &lt;span&gt;Find e-mail on &lt;a href="#"&gt;My Address Book&lt;/a&gt; / &lt;a href="#"&gt;Contacts&lt;/a&gt;&lt;/span&gt; &lt;span&gt;Find e-mail on &lt;asp:HyperLink ID="HyperLink1" runat="server"&gt;Facebook Profile&lt;/asp:HyperLink&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;label&gt;Invite Type&lt;/label&gt; &lt;div class="col"&gt; &lt;div class="inner-row"&gt; &lt;asp:RadioButton runat="server" ID="r1" Checked="true" GroupName="r" /&gt; &lt;label for="id-1"&gt;&lt;em&gt;Personalized&lt;/em&gt; - Add a personal note to your invitation. This invite type will let your friend know of your identity and will include your personal note&lt;/label&gt; &lt;/div&gt; &lt;div class="inner-row"&gt; &lt;asp:RadioButton runat="server" ID="r2" GroupName="r" /&gt; &lt;label for="id-2"&gt;&lt;em&gt;Anonymous&lt;/em&gt; - Sending an invite anonymously will not reveal your indentity to your friend.&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;label for="message"&gt;Personal Note&lt;/label&gt; &lt;div class="col"&gt; &lt;div class="textarea"&gt; &lt;div class="textarea-holder"&gt; &lt;asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Rows="10" Columns="30" onchange="javascript:updateHiddenField1();"&gt;&lt;/asp:TextBox&gt;&lt;asp:HiddenField ID="HiddenField2" runat="server" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;span class="text-note"&gt;Including a note is optional, but isn’t&lt;br /&gt;personalized messages always nice :)&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;asp:LinkButton ID="LinkButton6" runat="server" onClick="LinkButton6_Click" CssClass="btn-send"&gt;&lt;/asp:LinkButton&gt; </code></pre> <p>This is my aspx code and i am trying to transfer values first from textbox then to hiddenfield and then codebehind</p> <pre><code> &lt;script type="text/javascript"&gt; function updateHiddenField() { document.getElementById('HiddenField1').value = document.getElementById('TextBox2').value; } function updateHiddenField1() { document.getElementById('HiddenField2').value = document.getElementById('TextBox1').value } &lt;/script&gt; </code></pre> <p>Values are getting displayed when i do <code>alert(document.getElementById('HiddenField1').value);</code></p> <p>However they aren't passed to codebehind </p> <pre><code> public void LinkButton6_Click(object sender, EventArgs e) { try{ System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); mail.Subject = ""; mail.Body = HiddenField1.Value; mail.To.Add(HiddenField2.Value); ////send the message System.Net.Mail.SmtpClient mySmtpClient = new System.Net.Mail.SmtpClient(); System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("",""); //mySmtpClient.Port="25"; mySmtpClient.Host = ""; mySmtpClient.UseDefaultCredentials = false; mySmtpClient.Credentials = myCredential; mySmtpClient.Send(mail); } catch (Exception ex) { Response.Write(ex.ToString()); } </code></pre> <p><img src="https://i.stack.imgur.com/fIEx7.jpg" alt="enter image description here"></p> <p>EDIT:</p> <ol> <li><p>I have tried using <code>mail.Body = TextBox2.Text; mail.To.Add(TextBox1.Text); </code></p></li> <li><p>I have tried without the UpdatePanel</p></li> <li><p>The code is in the CSS popup that is the main issue </p></li> </ol> <p>AS suggested i have used html button to call javascript function</p> <pre><code> function btn_click() { var email = document.getElementById('HiddenField1').value; var body = document.getElementById('HiddenField2').value; } </code></pre> <p>How do i pass this value as my credentials in Asp.net</p> <p>Please help </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload