Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
i have no idea on how to set default focus on textbox in asp.net in aspx page i have a image button for logout and textbox and button for getting data from database. here i am getting error when i enter text in textbox instead of clicking the button to get data i am pressing enter keyword then the application is getting logout meaning that what i have returned code for logout image button getting executed.
so overall here enter keyword focus is executing image button code so how to avoid enter focus on image button.
Please give solution for this problem.


Thanks&Regards,
Raghu.
Posted

1 solution

on page load inside put focus on other button control as by default it is being set on ur logout button

if(!IsPostBack)
{
otherbtnObject.Focus()
}


hope it'll help
 
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