How to force a click on ASP.Net Button

B

BudhramM

Hi,

I have a webpage that has 2 ASP.Net buttons as well as some other
controls. The controls are split up into two, there is a set of Combo
boxes and then there is a single text input box. The controls are
seperated by DIV's to create a TABView. So when clicking on the 1st tab
will show the combo boxes and a button, the second tab will show a text
box and a button.

What I would like is for these buttons to be the default dependant on
which tab was selected. I have managed to find what tab is clicked, but
I need to know how I can set focus on a specified ASP.Net button.

Any ideas. You can view the site: http://www.kitchensink.co.za.

Thanx
 
N

nsimeonov

Hi,

here's how to "simulate" a button click:

document.forms[0].MyButton.click();

here's for example in an anchor tag:

<a href="javascript:document.forms[0].MyButton.click();">simulate
button click</a>

Also you may use the onkeypress event for the textbox:

<input type=text size=50 class="input_small" id=txtKeyword
name=txtKeyword onkeypress="if(event.keyCode==13){
doSearch(this.value); return false; }" >

Another solution would be to disable the button on the first tab when
the second one is active and vice versa.

Hope this helps,
Nikolay




(e-mail address removed) напиÑа:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top