textbox event
-
Why you don't use javscript for that calculation?
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
Here it is.
function Calculate() { document.getElementById('<%=txttotalprice.ClientID%>').value= document.getElementById('<%=txtqty.ClientID%>').value * document.getElementById('<%=txtproductprice.ClientID%>').value }
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
hii... i hav 3 textbox named:txtqty,txtproductprice,txttotalprice. i want that when the cursor goes to txttotalprice.the txttotalprice textbox get initialized by the value which is multiple of txtqty and txtproductprice.i hav used the textbox changed event of txttotalprice like this: then i hav coded it like this: protected void txttotalprice_TextChanged(object sender, EventArgs e) { string s = txtqty.Text; string k = txtproductprice.Text; int i = Convert.ToInt32(s); int j = Convert.ToInt32(k); int l = i * j; txttotalprice.Text = Convert.ToString(i); } but it doesnt show any value in txttotalprice...
hi you know , i think you`d better not do that like this !!! :-D because ontextchanged , sends the information to the server andyour page relodes and takes so much time ! it`s better to do this on client side with java script something like this :
var quantity = document.getElementById('txtqty').value;
var price = document.getElementById('txtproductprice').value;
document.getElementById('txttotalprice').value = quantity*price;:cool:
-
hi you know , i think you`d better not do that like this !!! :-D because ontextchanged , sends the information to the server andyour page relodes and takes so much time ! it`s better to do this on client side with java script something like this :
var quantity = document.getElementById('txtqty').value;
var price = document.getElementById('txtproductprice').value;
document.getElementById('txttotalprice').value = quantity*price;:cool:
-
is there any other way to do this without using javascript bcoz i dont know javascript n how to implement it... :(
-
javascript is the best way ;) if you have a masterpage , the way that blue boy said is better than mine :) code it like this in your .aspx page :
the code that blue boy said
-
is there any other way to do this without using javascript bcoz i dont know javascript n how to implement it... :(
//as sajjy says function total() { var quantity = document.getElementById('txtqty').value; var price = document.getElementById('txtproductprice').value; document.getElementById('txttotalprice').value = quantity*price; } //call that event in the textbox onblur():
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
hii... i hav 3 textbox named:txtqty,txtproductprice,txttotalprice. i want that when the cursor goes to txttotalprice.the txttotalprice textbox get initialized by the value which is multiple of txtqty and txtproductprice.i hav used the textbox changed event of txttotalprice like this: then i hav coded it like this: protected void txttotalprice_TextChanged(object sender, EventArgs e) { string s = txtqty.Text; string k = txtproductprice.Text; int i = Convert.ToInt32(s); int j = Convert.ToInt32(k); int l = i * j; txttotalprice.Text = Convert.ToString(i); } but it doesnt show any value in txttotalprice...
Dear Guys, You People have left one thing,onblur event(given by padmanabhan) should be written to Two text boxes(txtqty and txtproductprice).In Function we have to Check whether these two TextBoxes are not null and if it is not so , Then multiply and display data in third textbox. Writing an event for third textbox is of no use here. Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail. Come Forth Yourself to Click "Good Answer" for any expected solution. Let us Support our C Project Programmers who provide solutions here.
-
oh i forgot to say something else ;) in your code that you made textboxes you must add this function like this :
-
//as sajjy says function total() { var quantity = document.getElementById('txtqty').value; var price = document.getElementById('txtproductprice').value; document.getElementById('txttotalprice').value = quantity*price; } //call that event in the textbox onblur():
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
its not workin... function Calculate() { document.getElementById('<%=txttotalprice.ClientID%>').value= document.getElementById('<%=txtqty.ClientID%>').value * document.getElementById('<%=txtproductprice.ClientID%>').value } wat to do...
change it to this one :
function Calculate()
{
document.getElementById('<%=txttotalprice.ClientID%>').value=
document.getElementById('<%=txtqty.ClientID%>').value *
document.getElementById('<%=txtproductprice.ClientID%>').value}
notice that javascript is Case Sencetive ! :-\
-
change it to this one :
function Calculate()
{
document.getElementById('<%=txttotalprice.ClientID%>').value=
document.getElementById('<%=txtqty.ClientID%>').value *
document.getElementById('<%=txtproductprice.ClientID%>').value}
notice that javascript is Case Sencetive ! :-\
-
Dear Guys, You People have left one thing,onblur event(given by padmanabhan) should be written to Two text boxes(txtqty and txtproductprice).In Function we have to Check whether these two TextBoxes are not null and if it is not so , Then multiply and display data in third textbox. Writing an event for third textbox is of no use here. Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail. Come Forth Yourself to Click "Good Answer" for any expected solution. Let us Support our C Project Programmers who provide solutions here.
-
hiii.... sir there is no onfocus event.... the events are.. oninit(),onload(),onunload(),onprerender(),ontextchanged()... which event shud i use...
-
hehehe i know :-D visual studio is stupid ;) javascript runs at client computers , so don`t worry :) just use it :cool:
-
hiii great finally it worked... thanks alot... thank you very much sir specially sajjy,padmanabhan and blue boy... Best Regards pari....
You are welcome.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
yes you are right !!! :laugh: but first we can let him to create his first javascript , then he can do any thing he wants ;)