469,306 Members | 2,549 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

How to force a click on ASP.Net Button

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

Jun 6 '06 #1
1 16986
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


Bu******@gmail.com написа:
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


Jun 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by xscully | last post: by
5 posts views Thread by Selden McCabe | last post: by
8 posts views Thread by Amirallia | last post: by
8 posts views Thread by Keith H | last post: by
reply views Thread by comp.lang.php | last post: by
2 posts views Thread by =?Utf-8?B?U2lsa0NpdHlGbG9yaWRh?= | last post: by
4 posts views Thread by anudu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.