TextBox problem
-
I have two textbox for adding two values and i need to display in 3rd textbox without any button click event. if i click on 3rd textbox after entering the values in 1,2 textbox,is it give the result in 3rd textbox.If so how?other wise how to that without any button click event/ Like a+b=c txtbox1=a txtbox2=b txtbox3=c Give an idea
kissy
-
I have two textbox for adding two values and i need to display in 3rd textbox without any button click event. if i click on 3rd textbox after entering the values in 1,2 textbox,is it give the result in 3rd textbox.If so how?other wise how to that without any button click event/ Like a+b=c txtbox1=a txtbox2=b txtbox3=c Give an idea
kissy
you can either do it all client side and use the onblur event on A and B to call a function that checks both A an B for values and if they have values fills C with their sum or you can do it clientside using the autopostback="true" and then using the OnTextChanged event to make the same operations.
Cheers, Dani
-
I have two textbox for adding two values and i need to display in 3rd textbox without any button click event. if i click on 3rd textbox after entering the values in 1,2 textbox,is it give the result in 3rd textbox.If so how?other wise how to that without any button click event/ Like a+b=c txtbox1=a txtbox2=b txtbox3=c Give an idea
kissy
you can use javscript function when you are setting focus to your third textbox. <asp:textbox .... onFocus="javascript:alert('hello');> use your javascript function insteadof alert();
-
you can use javscript function when you are setting focus to your third textbox. <asp:textbox .... onFocus="javascript:alert('hello');> use your javascript function insteadof alert();
-
I dont have idea how to write javascript for this type of problem.Give me with an example so that i can try for that. Thanks in advance
kissy
-
you can either do it all client side and use the onblur event on A and B to call a function that checks both A an B for values and if they have values fills C with their sum or you can do it clientside using the autopostback="true" and then using the OnTextChanged event to make the same operations.
Cheers, Dani
-
I dont have idea how to write javascript for this type of problem.Give me with an example so that i can try for that. Thanks in advance
kissy
write : function addTwoTextbox { document.getElementById("Textbox3").value = document.getElementById("Textbox1").value + document.getElementById("Textbox2").value; } and call addTwoTextbox() fn where you declared textbox like : <asp:textbox id=... runat=... onFocus="javascript:addTwoTextbox();">