Click to See Complete Forum and Search --> : web form and button focus


pschiff
November 3rd, 2005, 07:00 PM
help

in my wb form, i want a button to have the default selected focus. i assigned it index 0 but at runtime it is not selected. Infact no button on the form has the focus so if i press ENTER - nothing happens.
Any idea whats wrong?

HanneSThEGreaT
November 4th, 2005, 02:25 AM
If you select the button, and look in the properties, Is there a TabIndex property ¿

pschiff
November 4th, 2005, 10:30 AM
as i said in my previous text - yes i set its index to 0 and its the only control set to that value.

HanneSThEGreaT
November 5th, 2005, 01:36 AM
as i said in my previous text - yes i set its index to 0 and its the only control set to that value.

If you were to give a control an Index of 0, you are essentially making a control array.
If you set the TabIndex property of a control, you set the Tab Order - so if I were to set a TabIndex property of a Control to 0, the control immediately has the focus.

So, Like I've asked, if the control has a TabIndex property, set it to 0.

pschiff
November 5th, 2005, 10:52 AM
it is set to 0. yet it doesnt work. Thats my original quesiton.

HanneSThEGreaT
November 7th, 2005, 12:45 AM
OK, I thought it was the Index :confused:

Anyways, look on your Web Form's properties - and see if there is a DefaultButton property, if it has, set its value to the name of your Button. Then whenever Enter is pressed your button's events will fire :thumb:

Rohit Kukreti
November 7th, 2005, 06:05 AM
Try Page.RegisterHiddenField("__EVENTTARGET", "Button1");
This would call the click event of Button1 when enter is pressed inside, saya Textbox.