Note that there are some explanatory texts on larger screens.

plurals
  1. POupdate textbox when changed without refreshing
    text
    copied!<p>I'm working on my own aspx program and now i have a calculator which i want to be able to fill in some values and when you press tab to the next value and fill it in it will automatically calculate and write it into a textbox(or label). this must be without having to refresh the page. would this be possible in combination with c# or would i need to look for php + ajax to get this done?</p> <p>i had the following coded:</p> <pre><code>&lt;asp:TextBox ID="tbx_rms" onchanged="textboxcalc" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbx_volt" onchanged="textboxcalc" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbx_anw1" Enabled="false" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbx_anw2" Enabled="false" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbx_eff" onchanged="textboxcalc" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="tbx_anw3" Enabled="false" runat="server"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>and this is the c# code:</p> <pre><code>public void textboxcalc(object sender, EventArgs e) { if (tbx_rms.Text != "" &amp;&amp; tbx_volt.Text != "") { double rms = Convert.ToDouble(tbx_rms.Text); double volt = Convert.ToDouble(tbx_volt.Text); double ant = Convert.ToDouble(rms / volt); if (tbx_eff.Text != "") { double effi = Convert.ToDouble(tbx_eff.Text); double tot = Convert.ToDouble((effi / ant) * 100); tbx_anw3.Text = Convert.ToString(tot); } tbx_anw1.Text = Convert.ToString(ant); tbx_anw2.Text = Convert.ToString(ant); } </code></pre> <p>I hope it is clear enough what my intentions are and if not i will happily answer any questions.</p>
 

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