Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Refreshing parent gridview from modalpopupextender

$
0
0

I have been grappling with the following issue for quite a while now.

Situation: I have a myreviews.aspx page which displays a grid of employees and column1 shows the status of a paricular document related to the employee (like uploaded, reviewed etc etc) and another one of the columns is a dropdown field withvarious values in it. Each value when clicked will open a modal popup extender and display another aspx page. I accomplished this using an Iframe and the src attribute.

Example: value of say check out and edit in the dropdown will call checkout.aspx page which updates the underlying database table and also inserts an audit history to the audit table (inserts into the database). The pages are all invoked from the dropdowns selectedindexchanged method which has the autopostback set to true.

I have the gridview inside of an update panel as well.

If I just close the modalpopup using the CancelControlId attribute and associate it to an <asp:imagebutton, the database gets updated in the checkout.aspx, values inserted to the edit history and extender closes, but the gridview does not reflect the status of the doucment like reviewed etc (basically needs to be updated). so i tried placing a click event in the <asp:imagebutton and in that click event (code behind myreviews.aspx) and did the binding of the gridview again and updatepanel.update. what happens then is the inserted value gets reinserted again, or in other words checkout.aspx is invoked again.

I even tried using the oncancelscript in the popupextender and ued the _doPostback functionality, same problem.

I just don't know why the iframe page is getting called again from the imagebutton click event or from the oncancelscript javascript methodology.

Source page code snippet:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>

<style type="text/css">
    .modalBackground     
    {
        background-color: gray;     
        filter: alpha(opacity=60);     
        opacity: 0.6;
    }  
    </style>

<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>

 <asp:GridView ID="GVReviews" runat="server" AllowSorting="false" AutoGenerateColumns="False"
            CellPadding="4" ForeColor="#333333" GridLines="None" Width="800px" BorderColor="Black" Font-Size="12px">
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" />
            <RowStyle BackColor="#E3EAEB" HorizontalAlign="Left"/>
        <Columns>

<asp:BoundField DataField="FirstName" HeaderText="First Name" ></asp:BoundField>
<asp:BoundField DataField="SubmissionStatus" HeaderText="Project Status"></asp:BoundField>   

<asp:TemplateField HeaderText="Actions" ItemStyle-HorizontalAlign="Center">
                <itemtemplate>
                    <asp:DropDownList ID="drpActions" runat="server" OnSelectedIndexChanged = "drpActions_SelectedIndexChanged" AutoPostBack="true">
                        <asp:ListItem Text="Select Action" Value="Select Action"></asp:ListItem>
                    </asp:DropDownList>
                </itemtemplate>
 </asp:TemplateField>

<asp:Button ID="btnShowPopup" style="display:none" runat="server" />
    
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    TargetControlID="btnShowPopup"
    PopupControlID="pnlpopup"    
    BackgroundCssClass="modalBackground"
    CancelControlID="imgOK"

    >
    </asp:ModalPopupExtender>

<asp:panel ID="pnlpopup" runat="server" style="background-color:White;width:900px;">
  <table style="background-color:green;width:900px;">
        <tr>
            <th valign="middle" colspan="2" align="center" bgcolor="#99CCFF"  style="font-weight:bold;font-size:larger">
            <asp:Label ID="lblHeader" runat="server"></asp:Label>          
            <asp:ImageButton ID="imgOK" ImageUrl="images/modal-close.png" runat="server" ImageAlign="Right"/>
            </th>          
        </tr>
        
    </table>
    
    
     <iframe id="contentAreaFrame" src="" style="border:0px solid white;width:900px;height:550px;" runat="server" scrolling="no"></iframe>
     
   
</asp:panel>
</ContentTemplate>

</asp:UpdatePanel>

</asp:Content>

IFRAME SOURCE CODE SNIPPEt:

If Not Page.IsPostBack Then

'Now insert into edit history table
  insertEditHistory(var1, var2, var3, var4)

End if

So i just want to be able to close the popup as well as refresh the gridview in the parent page wuthout the values getting reinserted twice or in other words the checkout./aspx getting invoked...

Thanks for all the help


Viewing all articles
Browse latest Browse all 5678

Trending Articles