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 8994497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:26:44+00:00 2026-06-15T23:26:44+00:00

I have used below code for delete command of GridView, but when I press

  • 0

I have used below code for delete command of GridView, but when I press delete command , the data in grid view will not be refreshed, actually command deletes the row but grid view does not update. I have to refresh manually browser then grid view will be update.
Markup:

<div>

  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>



<asp:GridView ID="GridViewDocuments_Search" runat="server" AutoGenerateColumns=False 
          Visible="False" onrowcommand="GridViewDocuments_Search_RowCommand"  
  DataKeyNames="DocID" PageSize="100" EnableSortingAndPagingCallbacks="True"  >
    <Columns>
    <asp:TemplateField HeaderText = "Details">
           <ItemTemplate>
      <asp:Button ID ="btn_Show" Text="Details" runat= "server" CommandName= "Details" CommandArgument='<%#
        Container.DataItemIndex%>' />
        </ItemTemplate>
            </asp:TemplateField>


        <asp:BoundField DataField="DocumentNo" HeaderText="DocNo" />


        <asp:BoundField DataField="title" HeaderText="Title" SortExpression="title" />
        <asp:BoundField DataField="Docid" HeaderText="Docid" Visible="false" />
        <asp:CommandField ShowEditButton="True" />
        <asp:CommandField ShowDeleteButton="True" />
    </Columns>
</asp:GridView>
  </ContentTemplate>

  </asp:UpdatePanel>
</div>

The code:

protected void GridViewDocuments_Search_RowCommand(object sender, GridViewCommandEventArgs e)
{
    int rowindex = Convert.ToInt32(e.CommandArgument.ToString());
    _DataContext = new EDMSDataContext();

    int _Docid = (int)GridViewDocuments_Search.DataKeys[rowindex].Value;

     switch (e.CommandName)
    {
        case "Details":
           Response.Redirect("~/Documentfortest.aspx?DocID=" + _Docid);
            break;
        case "Delete":
            _DataContext.DeleteDoc(_Docid);

            break;

    }

 var query = _DataContext.spQuickSearchDoc(txtSearchKeywords.Text);

     GridViewDocuments_Search.DataSource = query;
     GridViewDocuments_Search.DataBind();


} 
  • 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-15T23:26:45+00:00Added an answer on June 15, 2026 at 11:26 pm

    Make sure that you re-assign the DataSource property before you call DataBind and then try ?

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

Sidebar

Related Questions

I have grid view with folowing complete code With Msaccess DB.I have used the
I have used below code to attach quckboook events // Subscribe to UI events...
I have some problem with my cfml website. I have used the below code
I have used the code below to read rfid tag values. try { if
Little trouble in using css, in the below code, i have used odd and
I get this error when I run the code below. I have normally used
I have used the below code to open an Excel file in MS Access
I want to Display Google Map into my wordpress site. I have used below
I have used Spring OXM and JiBX in my application. below is my Spring
I have created a procedure and used the below statement inside that . select

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.