Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to set focus on asp label control in update panel but it dosent work for me plz help


thanks in advance

What I have tried:

i am using this method of ajax script manager

ScriptManager.GetCurrent(Page).SetFocus(lblFocus)
Posted
Updated 7-Mar-18 20:51pm
Comments
CHill60 7-Mar-18 4:33am    
Where have you put that code and are you catering for postback?
Member 11101286 13-Mar-18 6:42am    
i put that code in code behind

actually i have 1 dropdown list which contain point nos like 1,2,3 and when i select 1 value from dropdown then focus must be set on perticular label which is in the Update panel
A_Griffin 7-Mar-18 7:26am    
Remember that labels don't receive focus. When you set the focus to a label it either passes to an associated control (webforms) or the next control in the TabIndex order (winforms).

1 solution

As per MSDN documentation, you can't.
Quote:
You can put the focus on the following types of controls:

  • Button, LinkButton, and ImageButton controls
  • CheckBox control
  • DropDownList control
  • FileUpload control
  • HyperLink control
  • ListBox control
  • RadioButton control
  • TextBox control


Source: How to: Set Focus on ASP.NET Web Server Controls[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900