473,466 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to set focus to a particular control in .net

139 New Member
Hai all,

Im having one image with link(www.google.com) on top of the page, bellow that one textbox and one button(search) is there.If i type text in textbox and if i press "enter" then that link is opening,how to set focus to search button...?

thanks,
Aswath.
Feb 25 '08 #1
6 1724
dip_developer
648 Recognized Expert Contributor
Hai all,

Im having one image with link(www.google.com) on top of the page, bellow that one textbox and one button(search) is there.If i type text in textbox and if i press "enter" then that link is opening,how to set focus to search button...?

thanks,
Aswath.
see here........
how to set focus on a control by javascript
Feb 25 '08 #2
todashah
26 New Member
In Case of if u r using c# then write down following code in the
key down event of text box.

if(e.KeyCode==Keys.Enter)
button1.Focus();

or

if u want that once u type something in text box & press enter key & its
invoke button then set acceptbutton property of form to name of button
in case of only one button is there on form.
Feb 25 '08 #3
kunal pawar
297 Contributor
u can give form as defaultbutton as hyperlink. so whn user press "Enter" that button will press.
Feb 26 '08 #4
bhappy
139 New Member
Hai
Thanks for replay,
Im using vb.net, where i didn't get any event like keydown for textbox

And i didn't got what is form defaultbutton as hyperlink? where should i apply this..??

thanks,
Aswath.
Feb 26 '08 #5
bhappy
139 New Member
Hia all,

Defaultbutton property is working in asp.net2.0 only but im using asp.net1.1
and i tried this method
txtsrh.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + ImageButton1.UniqueID + "','')return false;")

but it is not happening
Feb 26 '08 #6
kunal pawar
297 Contributor
may be it works
say return true at last not false;
Mar 12 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nemesis | last post by:
I've been up most of the night trying to get the basic searcg (find record) facility to pre focus on a particular fielf so that it only searches that field and returns the data for the whole form....
1
by: Jason Huang | last post by:
Hi, private void SetFocus(Control ctrl) // SetFocus to a particular control { string focusScript = "<script language='javascript' id='FocusScript'> " + "document.getElementById('" +...
6
by: Mike | last post by:
I have a few textbox controls that have autopostback so that when they loose focus they update a label control that shows the count of characters in their respective text control. This works fine,...
3
by: Joe Delphi | last post by:
Hi, I have more experience working with Windows.Forms than with WebForms and sometimes it trips me up. When my page loads, I want a particular textbox to have the focus. I am attempting to...
18
by: Euphor2 | last post by:
I'm in school, taking a VB .NET 2003 course, and the teacher taught us how to use Sender.Focus() to return focus to the control from which focus was received. However, when I got home, and tried...
2
by: Jack Russell | last post by:
I have a form containing a tab control I want focus set to a particular text box when the form opens. However doing this in the load form event If TabControl1.SelectedIndex = 0 Then If...
3
by: Tedmond | last post by:
Hi all, Can anyone tell me how to set focus to particular control on Page_Load() in ASP.Net? I could not find any Control.Focus() method. Thanks for any help! Tedmond
4
by: Jon Slaughter | last post by:
Is there any method to temporarily disable focus changing?(I assume only method is tab or mouse?) This problem has been tieing me up for a while and nothing seems to work. The only thing that I...
0
by: samadams_2006 | last post by:
Hello, I have a VB.NET Form which has a System.Windows.Forms.TabControl on it. This TabControl has 5 Tabs on it. On each tab, I have various textboxes, option boxes, radio boxes, etc. I would...
3
Wolfling
by: Wolfling | last post by:
I have a small VB6 app that uses an InternetExplorer control to retrieve some information from a website. It uses a polling technique (eg check the website every 60 seconds). My app remains hidden...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.