|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Select text in asp:textboxI am using Visual Studio 2005 and writing all code-behind in VB. I'm setting
the focus of a textbox after I run some calculations. I want to additionally select all the text in the textbox that I've set the focus to so that the user doesn't have to manually select the text and type. Can someone give me an example of how to do this programmatically using vb? Hi TJ,
Here's a little code that inserts some JavaScript when the page loads to select the text in a textbox. If you can use Atlas, you'll find a really nice technique for creating a Textbox watermark: http://atlas.asp.net/atlastoolkit/TextBoxWatermark/TextBoxWatermark.aspx Let us know if this helps? Ken Microsoft MVP [ASP.NET] <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load _ (ByVal sender As Object, _ ByVal e As System.EventArgs) Page.SetFocus("TextBox1") ClientScript.RegisterStartupScript _ (Me.GetType, "sel", _ "document.all.TextBox1.select();", True) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Select and Set Focus</title> <script language="javascript" type="text/javascript"> </script> </head> <body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server">Start typing here</asp:textbox><br /> <br /> <asp:button id="Button1" runat="server" text="Button" /> </div> </form> </body> </html> Show quoteHide quote "TJHerman" <TJHer***@discussions.microsoft.com> wrote in message news:1ABAF60D-8D45-42DB-AE4B-8B06D4571C96@microsoft.com... >I am using Visual Studio 2005 and writing all code-behind in VB. I'm >setting > the focus of a textbox after I run some calculations. I want to > additionally > select all the text in the textbox that I've set the focus to so that the > user doesn't have to manually select the text and type. Can someone give > me > an example of how to do this programmatically using vb?
Save Child GridView only when parent GridView Saved
fill ObjectDatasource on request apply an ItemTemplate dinamically Getting row index by Event Args... Programmatically enabling Validation Controls Failed to load viewstate. Getting error BC30560 with CR 11 Release 2 please help me with a dropdownlist selectindexchange event into a custom control Displayed and Saved Images are not the same... WHY?? How to disable Open/Save/Cancel dialog using WebBrowser |
|||||||||||||||||||||||