Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript change asp:textbox value to invoke subroutine

Status
Not open for further replies.

snobrdinrtiste

Programmer
Aug 22, 2005
24
US
hi everyone,
I was trying to use Javascript to change an asp:textbox's value and once that value changes I want the textbox__TextChanged SubRoutine to fire...
but the problem is, is that javascript will chance the textbox's value but the SubRouting will not fire unless i manually change the value in the asp:textbox...

does anyone know of a way to get the subroutine to fire?
 
try calling the onchange event directly using JS:

document.getElementById("txtBoxId").onchange();

Known is handfull, Unknown is worldfull
 
yes it will. try it...

Known is handfull, Unknown is worldfull
 
did it work???

Known is handfull, Unknown is worldfull
 
no i'm not sure how to do it...
can you give me a quick example?

i'm doing this:

document.getElementById("txtBoxId").onchange = function() {
//not sure what to put here to call the subroutine ???
}
 
document.getElementById("txtBoxId").onchange()

thats all, no function there, just that single line...

Known is handfull, Unknown is worldfull
 
vbkris,
what if i want to use an asp:textbox to handle the value change?

because i want to use that textbox's value in the subroutine...

is that possible?
 
yes u can, normally this onchange event is fired when u change the control's value normally. in JS u r just forcing the sme automatically, so it should work as if theere was a manual change...

Known is handfull, Unknown is worldfull
 
just that line doesn't work.... ie and firefox says there is an error with that statement... :(
 
k, will try it out and give u a sample...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top