I have an identical problem as one posted before but none of the response worked.

Here is the issue:

The UpdatePanel has an upload control and a button to upload. The button is set as a trigger, but the event handler for the button fails to execute on the first PostBack. The button works without fail on the second and subsequent times, just not the first. Any solution to it working on the first try.

My ASPX code is:

<asp:UpdatePanel ID="updPages" runat="server" UpdateMode="Conditional">
    <div class="tabs">
            <li><asp:LinkButton ID="lnkContentsPages" runat="server" OnClick="updateContents" CommandArgument="pages">Pages</asp:LinkButton></li>
    <%-- these tabs change the ActiveViewIndex to show a different UserControl --%>
            <li><asp:LinkButton ID="lnkContentsImages" runat="server" OnClick="updateContents" CommandArgument="images">Images</asp:LinkButton></li>
        <div class="tabbedContent">
            <asp:MultiView runat="server" ID="mltContentsInner" ActiveViewIndex="0">
                <asp:View ID="viwContentsImages" runat="server">
                    // ajax usercontrol for a list of images - works fine with ajax
                        <legend>Upload New</legend>
                        <div class="formRow">
                            <asp:Label ID="lblFile" runat="server" Text="Filename" AssociatedControlID="uplFile" />
                            <asp:FileUpload ID="uplFile" runat="server" />
                        <div class="formRow">
                            <asp:Label ID="lblImageDescription" runat="server" Text="Description" AssociatedControlID="txtImageDescription" />
                            <asp:TextBox runat="server" ID="txtImageDescription" />
                        <asp:Button ID="btnUpload" runat="server" Text="Upload" CssClass="c3button btnUpload" CausesValidation="false" OnClick="btnUpload_Click" />
                <asp:View ID="viwContentsPages" runat="server">
                    // ajax usercontrol - works fine with ajax
    <asp:PostBackTrigger ControlID="btnUpload" />

Related posts

Recent Viewed