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

How to clear textbox on change of combobox

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 08 Nov 2013, 07:47 PM
On client side how do you clear a textbox on change of a combobox that is on the same row.  They are both inside the radgrid. 

<telerik:GridTemplateColumn DataField="iActionID" FilterControlAltText="Filter iActionID column"
                    HeaderText="Issue" SortExpression="iActionID" UniqueName="iActionID">
    <ItemTemplate>
        <asp:HiddenField ID="HiddeniActionID" runat="server" Value='<%# Eval("iActionID") %>' />
        <telerik:RadComboBox ID="iActionID" runat="server" NoWrap="True"
            DataSource='<%# GetNextAvailableIssueTypes(Eval("iActionID")) %>' DataTextField="sActionDesc" DataValueField="iActionID"
            Width="200" SelectedValue='<%# Eval("iActionID") %>' EnableViewState="true" RenderMode="Lightweight"
            >
        </telerik:RadComboBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="sNewComment" HeaderText="Comments">
    <ItemTemplate>
        <telerik:RadTextBox ID="sNewComment" runat="server" Width="100%" Text='<%# Eval("sComment") %>'></telerik:RadTextBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Nov 2013, 06:32 PM
Hello,

<script type="text/javascript">
 
             
            function ClientSelectedIndexChanged(sender, args) {
                var txtID = sender.get_id().replace("iActionID", "sNewComment");
                txtsNewComment = $telerik.findTextBox(txtID);
                txtsNewComment.set_value("");
            }
 
 
        </script>
<telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <telerik:RadComboBox ID="iActionID" runat="server" OnClientSelectedIndexChanged="ClientSelectedIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="1" Value="1" />
                                    <telerik:RadComboBoxItem Text="12" Value="12" />
                                </Items>
                            </telerik:RadComboBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <telerik:RadTextBox ID="sNewComment" runat="server">
                            </telerik:RadTextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>


For more information please check below link.
Access Another control which was in same level or in row

Thanks,
Jayesh Goyani
0
Richard
Top achievements
Rank 1
answered on 11 Nov 2013, 11:54 AM
That works.  Thank you.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Richard
Top achievements
Rank 1
Share this question
or