Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

XML
<asp:GridView ID="grdComplianceElements" runat="server" AutoGenerateColumns="False"
        ViewStateMode="Enabled"  DataSourceID="ObjectDataSource1" DataKeyNames="ID" Font-Size="11px"
        Width="100%">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" Visible="false" />
            <asp:BoundField DataField="Title" HeaderText="Rating Element" />
            <asp:TemplateField HeaderText="Compliance Element">
                <ItemTemplate>
                    <asp:RadioButtonList ID="rblRComplianceElement" runat="server"   RepeatDirection="Horizontal"
                        DataValueField="ComplianceElementID" DataTextField="ComplianceElement" Font-Size="11px">
                    </asp:RadioButtonList>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="BasicRatingElement" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblBasicRatingElement" runat="server" Text='<%# eval("BasicRatingElement") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="AClassRatingElement" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblAClassRatingElement" runat="server" Text='<%# eval("AClassRatingElement") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="MaximumWeighting" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblMaximumWeighting" runat="server" Text='<%# eval("MaximumWeighting") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Center" HeaderText="Comments" Visible="true" ControlStyle-Width="200">
                <ItemTemplate>
                    <asp:TextBox  ID="txtComment" runat="server" Height="100px" Width="200px" TextMode="MultiLine" />
                </ItemTemplate>
            </asp:TemplateField>


            <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="" Visible="true" ControlStyle-Width="5px">
                <ItemTemplate>
                    <%--<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>
                </ItemTemplate>
            </asp:TemplateField>


        </Columns>
    </asp:GridView>
Posted

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900