UpdatePanel中FileUpload控件获取不到值的解决办法

今天做项目中遇到的问题,在网上查阅了资料,终于找到解决办法,原因是默认ajax是用get形式传值的,但是fileupload控件需要用post传值,所以现在需要用以下红色的字体的代码解决:

<asp:UpdatePanel runat="server">

                                <ContentTemplate>
                                    <asp:FileUpload ID="fuTargetScreen" runat="server" />
                                    <asp:Button ID="btnViewImage" runat="server" CausesValidation="false" OnClick="btnViewImage_Click" />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:PostBackTrigger ControlID="btnViewImage" />
                                </Triggers>
 </asp:UpdatePanel>

你可能感兴趣的:(Ajax,server,asp,button,triggers)