AJAX Asyncfileupload - how to refresh updatepanel after UploadedComplete

Discussion in 'ASP .Net' started by Mel, Jan 18, 2012.

  1. Mel

    Mel Guest

    I am using the latest AJAX control toolkit (4.1.51116.0). I have a
    modalpopupextender, AsyncFileUpload and a gridview inside an update
    panel in my web user control (.ascx) page . The modal popup extender
    appears and after the upload I want to update the gridview to display
    some of the data I read in from the file. I have search Goole forever
    and tried many solutions and I can't figure it out. Please help.
     
    Mel, Jan 18, 2012
    #1
    1. Advertisements

  2. Mel

    Mel Guest

    Nevermind. I finally got it. Here is my ascx file if this helps
    anyone out there.

    <%@ Control Language="VB" AutoEventWireup="false"
    CodeFile="ImportSubstrates.ascx.vb"
    Inherits="ImportSubstrates" %>
    <%@ Register Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit" TagPrefix="asp" %>

    <asp:ModalPopupExtender ID="mpeImportSubstrates" runat="server"
    BehaviorID="behidImp"
    TargetControlID="Button2" PopupControlID="pnlImportSubstrates"
    CancelControlID="btnImpDone"
    BackgroundCssClass="modalBackground" />
    <asp:panel ID="pnlImportSubstrates" Style="display: none"
    runat="server" CssClass="modalPopup"
    Width="1000px">
    <center>
    <b>Import Data</b></center>
    <br />
    Select the Excel file: <br />
    <div id="divImpSubmit" class="divSubstrateSubmit">
    <asp:AsyncFileUpload runat="server" ID="AsyncFileUpload1"
    Width="800px" UploadingBackColor="#CCFFFF" ThrobberID="myThrobber" />

    &nbsp;<asp:Label runat="server" ID="myThrobber"
    Style="display: none;"><img align="middle" alt="" src="images/
    uploading.gif" /></asp:Label>
    <asp:UpdatePanel ID="upImportedSubstrates" runat="server">
    runat="server" Text=""></asp:Label> <br /><br />
    <asp:GridView ID="gvSubstrates" runat="server" CellPadding="2"
    AutoGenerateColumns="False"
    EmptyDataText="No substrates have been imported."
    ForeColor="#333333">
    <Columns>
    <asp:TemplateField HeaderText="Item"
    SortExpression="Item" ItemStyle-Wrap="False">
    <EditItemTemplate>
    <asp:TextBox ID="txtItem" runat="server"
    Text='<%# Bind("Item") %>'></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="lblItem" runat="server" Text='<
    %# Bind("Item") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Desc"
    SortExpression="Desc" ItemStyle-Wrap="False">
    <EditItemTemplate>
    <asp:TextBox ID="txtDesc" runat="server"
    Text='<%# Bind("Desc") %>'></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="lblDesc" runat="server" Text='<
    %# Bind("Desc") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="UM" SortExpression="UM"
    ItemStyle-Wrap="False">
    <EditItemTemplate>
    <asp:TextBox ID="txtUM" runat="server" Text='<
    %# Bind("UM") %>'></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="lblUM" runat="server" Text='<%#
    Bind("UM") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Qty"
    SortExpression="Qty" ItemStyle-Wrap="False">
    <EditItemTemplate>
    <asp:TextBox ID="txtQty" runat="server" Text='<
    %# Bind("Qty") %>'></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="lblQty" runat="server" Text='<
    %# Bind("Qty") %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    <EditRowStyle BackColor="#999999" />
    <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-
    Bold="True" />
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333"
    HorizontalAlign="Left" />
    <PagerStyle BackColor="#284775" ForeColor="White"
    HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True"
    ForeColor="#333333" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True"
    ForeColor="White" />
    <AlternatingRowStyle BackColor="White"
    ForeColor="#284775" />
    <SortedAscendingCellStyle BackColor="#E9E7E2" />
    <SortedAscendingHeaderStyle BackColor="#506C8C" />
    <SortedDescendingCellStyle BackColor="#FFFDF8" />
    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    <div id="divDone" class="divSubstrateDone">
    <asp:Button ID="btnImpDone" runat="server" Text="Close"
    Width="50px" ValidationGroup="import" />
    </div>
    </asp:panel>
     
    Mel, Jan 18, 2012
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.