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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:20:36+00:00 2026-05-17T16:20:36+00:00

I have a Gridview within an UpdatePanel that shows some data from my Database.

  • 0

I have a Gridview within an UpdatePanel that shows some data from my Database. When you click on an edit button, it opens up a detailsView within a ModalPopupextender. When you enter in data in the textBoxes in this detailView and click “update”, the Database is updated but the popup does not hide. Then, when I close it manually by clicking “close”, the gridView does not refresh unless I refresh the page. I was able to get this to work before, but after spending a week staring at this problem, I decided to ask you guys to see what I am doing wrong.

Here’s some code! (Note: a lot of this is an adaptation of a tutorial I found)

<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:GridView ID="gvReservations" runat="server" CssClass="datagrid" DataKeyNames="dateSubmit"
                AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PageSize="10"
                DataSourceID="mainTable" Width="95%" OnRowUpdated="gvReservation_RowUpdated"  OnRowDataBound="OnRowDataBound" OnSelectedIndexChanged="GvReservations_SelectedIndexChanged">
                <Columns>
                    <asp:BoundField DataField="dateSubmit" HeaderText="Date Submitted" SortExpression="dateSubmit"
                        ReadOnly="true" />
                    <asp:BoundField DataField="lName" HeaderText="Name" SortExpression="lName" ReadOnly="true" />
                    <asp:BoundField DataField="startTime" HeaderText="Start Time" SortExpression="startTime"
                        ReadOnly="true" />
                    <asp:BoundField DataField="endTime" HeaderText="End Time" SortExpression="endTime"
                        ReadOnly="true" />
                    <asp:BoundField DataField="labName" HeaderText="Lab" SortExpression="labName" ReadOnly="true" />
                    <asp:BoundField DataField="class" HeaderText="Class" SortExpression="class" ReadOnly="true" />
                    <asp:BoundField DataField="term" HeaderText="Semester" SortExpression="term" ReadOnly="true" />
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnViewDetails" runat="server" Text="more" CommandName="Select" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="500px" Style="display: none;">
        <asp:UpdatePanel ID="updPnlReservationDetail" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
                <ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"
                    PopupControlID="pnlPopup" CancelControlID="btnClose"  BackgroundCssClass="modalBackground" />
                <asp:DetailsView ID="dvReservationDetail" runat="server" DataSourceID="SqlDetail"
                   OnDataBound="ReservationDetail_DataBound"  CssClass="detailgrid" GridLines="None" DefaultMode="Edit" AutoGenerateRows="false"
                      Visible="false" Width="100%" OnItemUpdating="ReservationDetail_Updating"   OnItemUpdated="ReservationDetail_Updated">
                    <Fields>

                    <asp:TemplateField HeaderText="ID">
                            <EditItemTemplate>
                                <asp:TextBox ID="tbID" runat="server" Text='<%# Bind("id") %>' ReadOnly="true" />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>

                        <asp:BoundField HeaderText="LabName" DataField="labName" />
                        <asp:BoundField  HeaderText="DateSubmitted" DataField="dateSubmit" />

                         <asp:TemplateField HeaderText="Start Time">
                            <EditItemTemplate>
                               <asp:TextBox ID="startTime" runat="server" Text='<%# Bind("startTime") %>' />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>


                        <asp:TemplateField HeaderText="End Time">
                            <EditItemTemplate>
                                <asp:TextBox ID="endTime" runat="server" Text='<%# Bind("endTime") %>' />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:CommandField ShowEditButton="true" />

                    </Fields>
                </asp:DetailsView>

                <div class="footer">

                    <asp:LinkButton ID="btnClose" runat="server" Text="Close" CausesValidation="false" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>

These are the events where I thought it would close the popup and update the gridView

protected void ReservationDetail_Updated(object sender, DetailsViewUpdatedEventArgs e)
    {
        if (this.Page.IsValid)
        {

            //  move the data back to the data object
           // this.dvReservationDetail.UpdateItem(false);
            dvReservationDetail.Visible = false;

            //  hide the modal popup
            mdlPopup.Hide();

            //  refresh the grid

            this.gvReservations.DataBind();
            this.updatePanel.Update();
        }

    }

Thanks for the help!

  • 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-05-17T16:20:37+00:00Added an answer on May 17, 2026 at 4:20 pm

    try to use single update panel on page
    place all controls inside it.

    <asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="500px" Style="display: none;">
                <asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
                <ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"
                    PopupControlID="pnlPopup" CancelControlID="btnClose"  BackgroundCssClass="modalBackground" />
                <asp:DetailsView ID="dvReservationDetail" runat="server" DataSourceID="SqlDetail"
                   OnDataBound="ReservationDetail_DataBound"  CssClass="detailgrid" GridLines="None" DefaultMode="Edit" AutoGenerateRows="false"
                      Visible="false" Width="100%" OnItemUpdating="ReservationDetail_Updating"   OnItemUpdated="ReservationDetail_Updated">
                    <Fields>
    
                    <asp:TemplateField HeaderText="ID">
                            <EditItemTemplate>
                                <asp:TextBox ID="tbID" runat="server" Text='<%# Bind("id") %>' ReadOnly="true" />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>
    
                        <asp:BoundField HeaderText="LabName" DataField="labName" />
                        <asp:BoundField  HeaderText="DateSubmitted" DataField="dateSubmit" />
    
                         <asp:TemplateField HeaderText="Start Time">
                            <EditItemTemplate>
                               <asp:TextBox ID="startTime" runat="server" Text='<%# Bind("startTime") %>' />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>
    
    
                        <asp:TemplateField HeaderText="End Time">
                            <EditItemTemplate>
                                <asp:TextBox ID="endTime" runat="server" Text='<%# Bind("endTime") %>' />                                    
                            </EditItemTemplate>
                        </asp:TemplateField>
                        <asp:CommandField ShowEditButton="true" />
    
                    </Fields>
                </asp:DetailsView>
    
                <div class="footer">
    
                    <asp:LinkButton ID="btnClose" runat="server" Text="Close" CausesValidation="false" />
                </div>            
    </asp:Panel>
    

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

Sidebar

Related Questions

No related questions found

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.