Solved

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

Posted on 2006-11-14
2
839 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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