Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
Good Day
I have a ASP.NET Gridview which is data bound, I wish to clear a row of this Gridview of it's selections.
In each Row is a textbox, a radiolist group and a link button which will be used to Clear the row; how would I clear the textbox and radiolist group items which are selected in javascript so I don't cause a postback.
<asp:GridView ID="grdComplianceElements" runat="server" AutoGenerateColumns="False"
        ViewStateMode="Enabled"  DataSourceID="ObjectDataSource1" DataKeyNames="ID" Font-Size="11px"
            <asp:BoundField DataField="ID" HeaderText="ID" Visible="false" />
            <asp:BoundField DataField="Title" HeaderText="Rating Element" />
            <asp:TemplateField HeaderText="Compliance Element">
                    <asp:RadioButtonList ID="rblRComplianceElement" runat="server"   RepeatDirection="Horizontal"
                        DataValueField="ComplianceElementID" DataTextField="ComplianceElement" Font-Size="11px">
            <asp:TemplateField HeaderText="BasicRatingElement" Visible="false">
                    <asp:Label ID="lblBasicRatingElement" runat="server" Text='<%# eval("BasicRatingElement") %>'></asp:Label>
            <asp:TemplateField HeaderText="AClassRatingElement" Visible="false">
                    <asp:Label ID="lblAClassRatingElement" runat="server" Text='<%# eval("AClassRatingElement") %>'></asp:Label>
            <asp:TemplateField HeaderText="MaximumWeighting" Visible="false">
                    <asp:Label ID="lblMaximumWeighting" runat="server" Text='<%# eval("MaximumWeighting") %>'></asp:Label>
            <asp:TemplateField ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center" HeaderText="Comments" Visible="true" ControlStyle-Width="200">
                    <asp:TextBox  ID="txtComment" runat="server" Height="100px" Width="200px" TextMode="MultiLine" />

            <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="" Visible="true" ControlStyle-Width="5px">
                    <%--<asp:LinkButton Font-Underline="true" Font-Bold="true" runat="server" ID = "lbDelete" Text = "Clear" CommandName="Clear" CommandArgument='<%# Container.DataItemIndex %>'></asp:LinkButton>--%>
                    <asp:LinkButton Font-Underline="true" Font-Bold="true" runat="server" ID = "lbDelete" Text = "Clear" OnClientClick="ClearRow(this)"></asp:LinkButton>

Posted 26-Nov-12 1:15am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 225
1 OriginalGriff 145
2 Sergey Alexandrovich Kryukov 137
3 manoj kumar choubey 115
4 _Amy 115
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,749
3 Peter Leow 3,408
4 DamithSL 2,555

Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100