|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can I set initial focus from server-side into textbox?I am showing/hiding a variety of panels that have different text boxes via code-behind functions. Depending on the condition, I would like to have the focus be set on a specific text box. However, all examples I've seen do this from the client side. Does anyone have a way to easily to specify the textbox to focus on from a code-behind function? My guess is it will have to be some combination of server-side and client-side coding. Any help would be appreciated. Thanks! -- Kent Iler ---------------------------------------------------------------------- kent@iler.NOSPAM.com Please CC: all replies via e-mail Remove .NOSPAM from e-mail address Hi Kent,
Yeah you can bring to the focus to some controls based on some condition. I believe you know how to bring the focus to a control using java script. What you need to do here is make that script to trigger from the code behind file. There are two ways to running the script from the code behind file. 1. Printing the script using response.write. eg. Response.Write("<script>text1.focus()</script>") 2. Using Page.RegisterStartupScript Page.RegisterStartupScript("foc", "text1.focus()") Page.RegisterStartupScript will execute the script. With regards, Sadha Sivam S, Microsoft Community Star, Sr. Software Engineer, Aspire Systems, www.dotnetspider.com Show quoteHide quote "Kent P. Iler" wrote: > Hi, > > I am showing/hiding a variety of panels that have different text boxes via > code-behind functions. Depending on the condition, I would like to have the > focus be set on a specific text box. However, all examples I've seen do > this from the client side. > > Does anyone have a way to easily to specify the textbox to focus on from a > code-behind function? My guess is it will have to be some combination of > server-side and client-side coding. > > Any help would be appreciated. > > Thanks! > > -- Kent Iler > ---------------------------------------------------------------------- > kent@iler.NOSPAM.com > Please CC: all replies via e-mail > Remove .NOSPAM from e-mail address > > > Something basic like this should work:
Response.Write "<script language = javascript>"& MyTextBox.ClientID & ".focus()</script>" Here is an even slicker approach: http://SteveOrr.net/faq/2in1.aspx Show quoteHide quote "Kent P. Iler" <kent@iler.NOSPAM.com> wrote in message news:NrmdnTGa65CB0-XfRVn-gA@comcast.com... > Hi, > > I am showing/hiding a variety of panels that have different text boxes via > code-behind functions. Depending on the condition, I would like to have > the focus be set on a specific text box. However, all examples I've seen > do this from the client side. > > Does anyone have a way to easily to specify the textbox to focus on from a > code-behind function? My guess is it will have to be some combination of > server-side and client-side coding. > > Any help would be appreciated. > > Thanks! > > -- Kent Iler > ---------------------------------------------------------------------- > kent@iler.NOSPAM.com > Please CC: all replies via e-mail > Remove .NOSPAM from e-mail address > Hi Kent,
You can make use form Data Format string property of the grid columns to format the date. For more input Refer http://www.dotnetspider.com/technology/kbpages/384.aspx. With regards, Sadha Sivam S, Microsoft Community Star, Sr. Engineer, Aspire Systems, www.dotnetspider.com Show quoteHide quote "Kent P. Iler" wrote: > Hi, > > I am showing/hiding a variety of panels that have different text boxes via > code-behind functions. Depending on the condition, I would like to have the > focus be set on a specific text box. However, all examples I've seen do > this from the client side. > > Does anyone have a way to easily to specify the textbox to focus on from a > code-behind function? My guess is it will have to be some combination of > server-side and client-side coding. > > Any help would be appreciated. > > Thanks! > > -- Kent Iler > ---------------------------------------------------------------------- > kent@iler.NOSPAM.com > Please CC: all replies via e-mail > Remove .NOSPAM from e-mail address > > >
How to get the HtmlForm element of an ASP.NET Page?
CreateUserWizard Control HELP! TabStrip with Multipage is not working! Hidden Controls yield inconsistent behavior on Postbacks Automatic updating an ASPX page HOWTO: Bring that row back into focus ... Text Length Listbox and multiple selection 2d graphics controls Text_Changed ? |
|||||||||||||||||||||||