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

[Solved] clear the content of RadTextBox

1 Answer 344 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 10 May 2013, 12:33 PM
Hi
     I want to clear the content of RadTextBox when the user focuses on a textbox so that the user can write his/her name.
thanks
Savyo

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 May 2013, 12:45 PM
Hi Savyo,

Please have a look at the following code I tried which works fine at my end.

ASPX:
<telerik:RadGrid ID="RadGrid1" AllowMultiRowSelection="true" runat="server" DataSourceID="SqlDataSource2"
    AutoGenerateEditColumn="true" AutoGenerateColumns="false" AllowSorting="true"
    ShowHeader="true" AllowFilteringByColumn="true" AllowPaging="true">
    <MasterTableView CommandItemDisplay="Top" TableLayout="Fixed" DataKeyNames="OrderID"
        ClientDataKeyNames="OrderID">
        <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" />
        <Columns>
            <telerik:GridTemplateColumn>
                <ItemTemplate>
                    <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="Enter Name : ">
                    <ClientEvents OnFocus="onfocus" />
                    </telerik:RadTextBox>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

JavaScript:
<script type="text/javascript">
    function onfocus(sender, args) {
        sender.clear();
    }
</script>

Thanks,
Shinu.
Tags
Grid
Asked by
Savyo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or