Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7892349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:50:52+00:00 2026-06-03T06:50:52+00:00

I have a gridview, on clicking a delete button, i need to remove the

  • 0

I have a gridview, on clicking a delete button, i need to remove the row for a while and on clicking the undo link, i need to re-display the row.

My gridview code is shown below:

  <asp:GridView ID="NotificationHistory" runat="server" AllowPaging="True"
        AutoGenerateColumns="False" DataKeyNames="Id" 
        ShowHeader="False" PagerSettings-Mode="NumericFirstLast"
        FooterStyle-BorderStyle="None" EnableViewState="False" GridLines="None" >
        <PagerSettings Mode="NumericFirstLast"></PagerSettings>
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <img alt="Delete" title="Delete" src="SiteImages/X.gif" 
                        onclick="changeImage(this)" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ItemName") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("ItemName") %>'></asp:Label>
                </ItemTemplate>

            </asp:TemplateField>
            <asp:TemplateField HeaderText="Status">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Status") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Status") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle BorderColor="#F1E8E8" BorderStyle="Solid" BorderWidth="1px" CssClass="gridItemAlignment" />
            </asp:TemplateField>
            <asp:BoundField DataField="Id" HeaderText="ID" Visible="false" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="ImgDelete" runat="server" Width="16px" Height="16px" CommandName="Remove"
                        ImageUrl="SiteImages/X.gif" ClientIDMode="Static" Enabled="false" />
                    <asp:HiddenField ID="hFType" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle Height="10px" BorderColor="Silver" BorderStyle="None" BorderWidth="0" />
        <FooterStyle BorderStyle="None"></FooterStyle>
        <PagerStyle HorizontalAlign="Right" BorderStyle="None" ForeColor="#999999"></PagerStyle>
        <EmptyDataTemplate>
            <asp:Label ID="lblHistory" runat="server">No History.</asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>

My html :

<table id="ctl00_Content_NotificationHistory" class="home-history-grid" cellspacing="0" border="0" style="border-color: rgb(241, 232, 232); border-style: none; width: 100%; border-collapse: collapse;">
<tbody>
<tr class="home-history-grid-row">
<td>
<img height="16px" width="16px" onclick="changeImage(this)" src="SiteImages/X.gif" title="Delete" alt="Delete">
</td>
<td class="gridItemStyle" style="border: 1px solid rgb(241, 232, 232); width: 75%;">
<a href="ReportCreation.aspx?rid=207">Status Report for Kalista as on 05/03/2012</a>
</td>
<td class="gridItemAlignment" style="border: 1px solid rgb(241, 232, 232);">Saved</td>
<td>
<img id="ImgDelete" height="16px" width="16px" onclick="deleteRow(this)" src="SiteImages/X.gif" alt="">
<input id="ctl00_Content_NotificationHistory_ctl02_hFType" type="hidden" value="Cirrus.CirrusObjects.Report" name="ctl00$Content$NotificationHistory$ctl02$hFType">
</td>
</tr>
<tr class="home-history-grid-row">
<td>
</td>
<td class="gridItemStyle" style="border: 1px solid rgb(241, 232, 232); width: 75%;">
</td>
<td class="gridItemAlignment" style="border: 1px solid rgb(241, 232, 232);">Saved</td>
<td>
</td>
</tr>
</tbody>
</table>

My javascript to remove the row (This is removing the selected row, now i would like to know how i can re-display it on the same place):

 function deleteRow(imageElement) {
            var img = $(imageElement);
            imageElement.setAttribute("id", "selectedRow");
            alert($("selectedRow").siblings(":image"));
            var row = $(imageElement).closest('tr');
            $(row).remove();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:50:53+00:00Added an answer on June 3, 2026 at 6:50 am

    change this $(row).remove() to

    $(row).hide(); it will be hidden, when you want to show it again do $(row).show();

    or even this will be more slicker

    $(row).toggle(); ( behind the scene it will be setting display=’none’ to hide)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Gridview in my Web application.I need ,while clicking the (ExcelExpot) button
I have a GirdView table in my application. I have a Delete link button
I have button in one of the columns in a gridview. On clicking on
I have a gridview that is only shown in a modal popup. right before
Greetings, In my current project, I have gridview, search button, text box for search,
I have a gridview, I am allowing user to enter HTML data while editing
I have a gridview and when a user selects a row I want to
I have a TextBox, GridView and Button such as txtCount, gvCount and btnCount. The
A typical situation: In my GridView control, I have a Footer row which contains
I have a aspxgridview with details row. in detils row of this gridview, there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.