c# - How to access button in an item template of an asp.net "gridview" using Javascript? -


i relatively new programmer. have gridview in button repeated every row.this button item template. when user clicks button, textbox colums value should changed using javascript. tried. going perfect. when click button in row of grid, text of textbox of row changed disappears. looks posting back. how stop this??

onclientclick ="myfunct(this)"

function myfunc(x){    var id=x.id;    var newid = id.substring(0, 18);    newid+="textbox1";    document.getelementbyid(newid).value="ghjhghjg"; } 

regards

ok found answer. need return false onclientclick prevent postback.

function myfunc(x){ var id=x.id; var newid = id.substring(0, 18); newid+="textbox1"; document.getelementbyid(newid).value="ghjhghjg"; return false; } 

onclientclick="return myfunc()"

thats it


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -