Solved

ASP.NET, .NET 2.0, textbox "lost focus" help needed...

Posted on 2006-11-14
2
829 Views
Last Modified: 2013-11-25
Hi all,
I'm having trouble finding an answer and hope you can help.

I have an ASP.NET form (using VS 2005 and .NET 2.0) that has 3 textboxes on it.  I want to be able to add the value of textbox1 to the value of textbox2 and add it to textbox3 on the client side without a trip to the server.

Can you provide a snippet of code that shows how to do something like this?

Thanks,
Terry
0
Comment
Question by:colepc
2 Comments
 
LVL 6

Accepted Solution

by:
badalpatel earned 500 total points
ID: 17944968
u have to write this script

<script language="javascript" type="text/javascript">
function summation()
{
    document.getElementById("textbox3").value = (document.getElementById("textbox1").value)/1 + (document.getElementById("textbox2").value)/1
}
</script>

and on aspx.vb u have to just call this script function like

textbox1.Attributes.Add("onchange", "javascript:summation()")
        textbox2.Attributes.Add("onchange", "javascript:summation()")
0
 

Author Comment

by:colepc
ID: 17947407
Thanks!  That worked great.  Can you point me to a web reference for where I can learn more about what "attributes" are possible.  For example, you show an "onchange" event attribute.  I'd like to explore more of those.

Thanks again for your solution.

Terry
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question