在带有更新面板的ajax选项卡容器中使用时,文件上载程序无法正常工作

时间:2012-09-03 11:58:37

标签: asp.net file-upload asp.net-ajax

我正在使用带有更新面板和文件上传器的

fileuploaderId.HasFille总是空白。

这是我的HTML代码

     <cc1:TabPanel ID="tour" runat="server">
                        <HeaderTemplate>
                            <span class="label_Tag_big">भ्रमण (Tours)</span></HeaderTemplate>
                        <ContentTemplate>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <center class="control_bg">
                                        <table width="75%" cellspacing="1">
                                            <tr>
                                                <td style="background-color: #996666">
                                                    <table width="100%" align="center" cellpadding="0" cellspacing="1">
                                                        <tr class="form_heading">
                                                            <td colspan="2">
                                                                <asp:Label ID="lbl" runat="server" Text="भ्रमण (Tours)"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;विभागाध्‍यक्ष / अधिकारी का पद नाम
                                                            </td>
                                                            <td>
                                                                designation location, department
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;<asp:Label ID="lblCurrentTT" runat="server"></asp:Label>
                                                                का लक्ष्‍य
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lblTargetT" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;<asp:Label ID="lblCurrentTA" runat="server"></asp:Label>
                                                                की लक्ष्‍य प्राप्ति
                                                            </td>
                                                            <td>
                                                                <asp:Label ID="lblAchivedT" runat="server"></asp:Label>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="form_sub_heading" colspan="2" align="left">
                                                                भ्रमण का विवरण (Tours details)
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td width="45%">
                                                                &nbsp;दौरे का स्थान
                                                            </td>
                                                            <td width="55%">
                                                                <table width="100%" cellpadding="3" cellspacing="0">
                                                                    <tr>
                                                                        <td width="50%">
                                                                            <asp:DropDownList ID="ddlLocLevel" runat="server" OnSelectedIndexChanged="ddlLocLevel_SelectedIndexChanged"
                                                                                AutoPostBack="True" Width="200px" />
                                                                            <asp:RequiredFieldValidator ID="rfqLocLevel" runat="server" InitialValue="0" ControlToValidate="ddlLocLevel"
                                                                                Display="None" ErrorMessage="दौरे का स्थान चुनें " ValidationGroup="tour"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                        <td width="50%">
                                                                            <asp:DropDownList ID="ddlLocation" runat="server" OnSelectedIndexChanged="ddlLocation_SelectedIndexChanged"
                                                                                AutoPostBack="True" Width="200px">
                                                                                <asp:ListItem Text="-- चुनें --" Value="0"></asp:ListItem>
                                                                            </asp:DropDownList>
                                                                            <asp:RequiredFieldValidator ID="rfqLocation" runat="server" InitialValue="0" ControlToValidate="ddlLocation"
                                                                                Display="None" ErrorMessage="-- चुनें --" ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>
                                                                            <asp:DropDownList ID="ddlSubDistrict" runat="server" OnSelectedIndexChanged="ddlSubDistrict_SelectedIndexChanged"
                                                                                AutoPostBack="True" Width="200px">
                                                                                <asp:ListItem Text="-- तहसील चुनें --" Value="0"></asp:ListItem>
                                                                            </asp:DropDownList>
                                                                            <asp:RequiredFieldValidator ID="rfqddlSubDistrict" runat="server" InitialValue="0"
                                                                                ControlToValidate="ddlSubDistrict" Display="None" ErrorMessage="-- चुनें --"
                                                                                ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                        <td>
                                                                            <asp:DropDownList ID="ddlPoliceStation" runat="server" Width="200px">
                                                                                <asp:ListItem Text="-- पुलिस थाना चुनें --" Value="0"></asp:ListItem>
                                                                            </asp:DropDownList>
                                                                            <asp:RequiredFieldValidator ID="rfqddlPoliceStation" runat="server" InitialValue="0"
                                                                                ControlToValidate="ddlPoliceStation" Display="None" ErrorMessage="-- पुलिस थाना चुनें --"
                                                                                ValidationGroup="tour" Enabled="false"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;<asp:Label ID="lblTourStartDate" runat="server" Text="दौरे की तिथि "></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtTourStartDate" runat="server" Width="25%" CssClass="date" onkeypress="return false;"
                                                                    onPaste="return false;"></asp:TextBox>
                                                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTourStartDate"
                                                                    Format="dd/MM/yyyy">
                                                                </cc1:CalendarExtender>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTourStartDate"
                                                                    ErrorMessage="दौरे की आरम्भिक तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
                                                                &nbsp;&nbsp;से&nbsp;&nbsp;
                                                                <asp:TextBox ID="txtTourEndDate" runat="server" Width="25%" onkeypress="return false;"
                                                                    onPaste="return false;"></asp:TextBox>
                                                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtTourEndDate"
                                                                    Format="dd/MM/yyyy">
                                                                </cc1:CalendarExtender>
                                                                &nbsp;&nbsp;तक&nbsp;&nbsp;
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtTourEndDate"
                                                                    ErrorMessage="दौरे की समाप्ति तिथि डाले" ValidationGroup="tour" Display="None"></asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;दौरे के दौरान निरीक्षण किया गया ?
                                                            </td>
                                                            <td>
                                                                <asp:RadioButtonList ID="rdbtnInsp" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"
                                                                    OnSelectedIndexChanged="rdbtnInsp_SelectedIndexChanged">
                                                                    <asp:ListItem Text="नही" Value="0"></asp:ListItem>
                                                                    <asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
                                                                </asp:RadioButtonList>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;निरीक्षण नही किये जाने की स्थिति मे टिप्पणी
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtConIns" runat="server" TextMode="MultiLine" MaxLength="4000"
                                                                    Enabled="false" Rows="3" Width="97%"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfqConIns" runat="server" ControlToValidate="txtConIns"
                                                                    ValidationGroup="tour" ErrorMessage="निरीक्षण नही किये जाने की स्थिति मे टिप्पणी डाले "
                                                                    Enabled="false" Display="None">
                                                                </asp:RequiredFieldValidator>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;दौरे के दौरान रात्री विश्राम किया गया ?
                                                            </td>
                                                            <td>
                                                                <asp:RadioButtonList ID="rdbtnNHault" runat="server" RepeatDirection="Horizontal"
                                                                    AutoPostBack="true" OnSelectedIndexChanged="rdbtnNHault_SelectedIndexChanged">
                                                                    <asp:ListItem Text="नही" Value="0"></asp:ListItem>
                                                                    <asp:ListItem Text="हाँ" Value="1"></asp:ListItem>
                                                                </asp:RadioButtonList>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtConNHault" runat="server" TextMode="MultiLine" MaxLength="4000"
                                                                    Enabled="false" Rows="3" Width="97%"></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfqConNHault" runat="server" ControlToValidate="txtConNHault"
                                                                    Display="None" ValidationGroup="tour" ErrorMessage="रात्री विश्राम नही किये जाने की स्थिति मे टिप्पणी डाले "
                                                                    Enabled="false">
                                                                </asp:RequiredFieldValidator>
                                                                <asp:ValidationSummary ID="vsTour" runat="server" ShowSummary="False" ShowMessageBox="true"
                                                                    ValidationGroup="tour" />
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td>
                                                                &nbsp;<asp:Label ID="Label8" runat="server" Text="संलग्न निरीक्षण रिपोर्ट "></asp:Label>
                                                            </td>
                                                            <td>
                                                                <asp:FileUpload ID="fuTourReport" runat="server" />
                                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Only pdf file is allowed!"
                                                                    ValidationExpression="^.+(.pdf|.PDF)$" ControlToValidate="fuTourReport" Display="None"
                                                                    ValidationGroup="nhalt"> </asp:RegularExpressionValidator>
                                                            </td>
                                                        </tr>
                                                        <tr class="bgColor" align="left" valign="top">
                                                            <td colspan="2" align="center">
                                                                <asp:Button ID="btnSaveTour" runat="server" Text="Submit" ValidationGroup="tour"
                                                                    OnClick="btnSaveTour_Click" CssClass="savetour" />
                                                                <asp:Button ID="btnCancelTour" runat="server" Text="Cancel" CausesValidation="False" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                        <center style="padding-top: 5px">
                                            <asp:GridView ID="grdTours" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                                DataKeyNames="tourId" Width="100%" OnPageIndexChanging="grdTours_PageIndexChanging"
                                                OnRowCommand="grdTours_RowCommand">
                                                <Columns>
                                                    <asp:BoundField DataField="Location_NameH" HeaderText="दौरे का स्थान " />
                                                    <asp:BoundField DataField="tourStartDate" HeaderText="आरम्‍भिक तिथि" DataFormatString="{0:dd/MM/yyyy}" />
                                                    <asp:BoundField DataField="tourEndDate" HeaderText="समाप्‍ति की तिथि" DataFormatString="{0:dd/MM/yyyy}" />
                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <asp:LinkButton ID="lnkinsdetail" runat="server" Text="Detail" CommandName="insdetail"
                                                                CommandArgument='<%#Eval("tourId")%>'></asp:LinkButton></ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                            </asp:GridView>
                                        </center>
                                    </center>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </ContentTemplate>
                    </cc1:TabPanel>
</cc1:TabContainer>

我已经尝试过这个

<Triggers>
    <asp:PostBackTrigger ControlID="clickButton" />
</Triggers>

protected void Page_Init(object sender, EventArgs e)
    {
        PostBackTrigger trig = new PostBackTrigger();

        trig.ControlID = btnSaveTour.UniqueID;

        UpdatePanel1.Triggers.Add(trig);
    }

但没有运气......

1 个答案:

答案 0 :(得分:1)

不幸的是,FileUpload控件在UpdatePanel

中不起作用

除了删除UpdatePanel或通过使用AsyncFileUpload控件之类的东西来解决它之外,你没有很多选择

有关详细信息,请参阅this answer

戴夫