Set Input Focus on a Control Programatically Added to an ASP.Net Page
I had a web page that automatically adds and removes TextBoxs based on a user's input e.g. a user may select "yes" in a DropDownList to a question and we need to get more information, so we add a Please Specify textbox on the postback of the DropDownList . But how on earth do you set the focus??
I tried adding the control to the page and then using its focus command, which didn't work.
ScriptManager mgr = (ScriptManager)this.Master.FindControl("ScriptManager1"); mgr.SetFocus(AdditionalInfoTextBox.ClientID);
Thank goodness for Google. I hope this helps you out..
A self confessed Microsoft bigot, Paul loves all Microsoft products with a particular fondness for SQL Server. Paul is currently focusing on Web 2.0 patterns and practices and is always looking for better ways of doing things.
I love the .net platform, and I find it to be the most productive toolset I have used to date.