This is a migrated thread and some comments may be shown as answers.

OnClick and RadTextBox

2 Answers 241 Views
Input
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 21 Jul 2010, 06:21 AM
Hi. What is the ClientEvents equivilant for OnClick for the RadTextBox? I can add it to the textbox itself and it works but VS gives me a warning saying the attribute isn't valid. As I said, the page still works okay, see code below. The function just clears the textbox when clicked in. Thanks.

Daniel

<telerik:RadTextBox ID="rtbLastname" runat="server" Skin="Default" Text="Last name" Width="99px" OnClick="if(this.value=='Last name')this.value='';"></telerik:RadTextBox>

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Jul 2010, 02:51 PM
Hello Daniel,

I guess you want to implement the watermark feature for textbox. If so, use the EmptyMessage property than using Text and clearing it. Check the mark-up shown below.

aspx:
<telerik:RadTextBox ID="rtbLastname" runat="server" Skin="Default" Width="99px" EmptyMessage="LastName">
</telerik:RadTextBox>

[And you can use the OnFocus client event which fires when focussing the textrbox]

Thanks,
Princy.
0
Daniel
Top achievements
Rank 1
Iron
answered on 21 Jul 2010, 11:25 PM
Wow, thanks Princy. That works great. I guess it helps to read to doco! Thanks again.

Daniel
Tags
Input
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Princy
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Iron
Share this question
or