Search:
Namespaces
Discussions
.NET v1.1
Feedback
how to implement an onclick on asp:TextBox?
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.framework.aspnet
.
Post a new message to this list...
Jan Hoffman
hi @all
I have the following element in an ascx-file:
<asp:TextBox id="name" runat="server">name</asp:TextBox>
The textbox belongs to an application of a telefonebook.
I want that if I click into the Textbox *once* that the text "name" is
selceted. at the moment I have to double-click.
any solutions to this problem?
thanks
Jan
Reply to this message...
Eliyahu Goldin
Jan,
It can be done in javascript on client side usind onclick event.
Eliyahu
"Jan Hoffman" <
Click here to reveal e-mail address
> wrote in message
news:el$
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Shiva
Try this:
<asp:TextBox RunAt=Server Id="name" onClick="this.select();" />
"Jan Hoffman" <
Click here to reveal e-mail address
> wrote in message
news:el$
Click here to reveal e-mail address
...
hi @all
I have the following element in an ascx-file:
<asp:TextBox id="name" runat="server">name</asp:TextBox>
The textbox belongs to an application of a telefonebook.
I want that if I click into the Textbox *once* that the text "name" is
selceted. at the moment I have to double-click.
any solutions to this problem?
thanks
Jan
Reply to this message...
Jan Hoffman
hi Shiva,
thank you....it works
but visual studio 2003 does not recognize the onclick parameter in the HTML
view! that's why I thought it would not work :(
Jan
"Shiva" <
Click here to reveal e-mail address
> schrieb im Newsbeitrag
news:ON%
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Eliyahu Goldin
Jan,
It already had been discussed once. OnClick is not documented for server
controls. Use it if you are happy with using undocumented features.
Otherwise use Attributes["onclick"] in code-behind.
Eliyahu
"Jan Hoffman" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Jan Hoffman
how can I impelent it with code behind?
Jan
"Eliyahu Goldin" <
Click here to reveal e-mail address
> schrieb im Newsbeitrag
news:%
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Shiva
Hi,
You use the Attributes collection: Text1.Attributes.Add ("onClick",
"this.select();"); // C#
"Jan Hoffman" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
how can I impelent it with code behind?
Jan
"Eliyahu Goldin" <
Click here to reveal e-mail address
> schrieb im Newsbeitrag
news:%
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Eliyahu Goldin
One way is to put a line (c# syntax)
name.Attributes["onclick"]="this.select();"
in the page's PreRender event handler.
Eliyahu
"Jan Hoffman" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com