简体   繁体   English

如何在更新面板外部的更新面板文件上传器中的按钮单击功能 .button 中获取文件上传器值

[英]How to take fileuploader value in button click function .button in update panel file uploader in outside of update panel

I have put asp button in update panel and asp file uploader in outside of update panel in server side button click function i am geting file uploader empty.give me any idea..my code is below我已将 asp 按钮放在更新面板中,并将 asp 文件上传器放在服务器端按钮单击功能中的更新面板外部,我得到文件上传器为空。给我任何想法..我的代码如下

     <asp:FileUpload  runat="server" ID="DecFormUpload"/>

     <asp:UpdatePanel runat="server" ID="UpdateDecForm" UpdateMode="Conditional">   
               <ContentTemplate>
         <asp:Button ID="DecFormUploadClick" OnClick="DecFormUploadClick_Click" OnClientClick="return DecFormUploadClick_Save();" runat="server" Text="Upload" />
         </ContentTemplate>      
                     </asp:UpdatePanel>

c# code代码

  protected void DecFormUploadClick_Click(object sender, EventArgs e)
{
    if(DecFormUpload.HasFile)//my problem is getting  false here
    {
       }

}

This issue is due to that FileUpload needs a full postback, add the following just after your这个问题是由于 FileUpload 需要一个完整的回发,在你的后面添加以下内容:

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

Hope it helps希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM