AsyncFileUploader [英] AsyncFileUploader

查看:108
本文介绍了AsyncFileUploader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面结构:
-content
---脚本管理器

-----更新面板

--------中继器


< cc1:AsyncFileUpload ThrobberID ="Img3" ID ="yukleyici" runat ="server" onupladcompleted ="yukleyici_UploadedComplete"
宽度="100%" EnableViewState ="False"/>

---------/中继器

-----/updatepanel

-/内容




后面的代码;

page struct :
-content
---script manager

----- update panel

--------repeater


<cc1:AsyncFileUpload ThrobberID="Img3" ID="yukleyici" runat="server" onupladcompleted="yukleyici_UploadedComplete"
Width="100%" EnableViewState="False" />

---------/repeater

-----/updatepanel

--/content




code behind ;

   protected void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        AsyncFileUpload fo = (AsyncFileUpload)e.Item.FindControl("yukleyici");

        PostBackTrigger trigger = new PostBackTrigger();

        trigger.ControlID = fo.ClientID;
      

        this.UpdatePanel1.Triggers.Add(trigger);

    }



 public void GetFiles()
{

 for (int i = 0; i < repeater.Items.Count; i++)
        {
            KullaniciResim yeni = new KullaniciResim ();

            AsyncFileUpload fu = (AsyncFileUpload)repeater.Items[i].FindControl("yukleyici");
         
            HiddenField hfevrakid = (HiddenField)repeater.Items[i].FindControl("hdEvrakTipId");
            HiddenField hfbasvuruid = (HiddenField)repeater.Items[i].FindControl("hdBasvuruTipId");
            yeni.BasvuruId = yenibasvuru.Id;
            yeni.EvrakId = Convert.ToInt32(hfevrakid.Value);
            yeni.IslemiYapan = Convert.ToInt32(this.Page.User.Identity.Name);
          
                if (fu.HasFile)
                {
                    yeni.ResimDurumu = true;
                    yeni.IslemTarihi = DateTime.Now;
                    yeni.ResimDosyasi = Guid.NewGuid().ToString().Trim(''-'') + fu.FileName;
                }
           
        }


}




与这些代码,我想在转发器中获取文件asyncfileuploaders.
但是fileuploaders onuploadcompleted事件永远不会触发. .我尝试了很多方法.作为添加触发器等.
谢谢所有关心的人.

[修改:固定的</pre>标签]




with these codes I want to getfiles asyncfileuploaders in repeater.
but fileuploaders onuploadcompleted event never fires. . I had tried many ways . as adding triggers etc.
Thanks everyone who cares.

[Modified: fixed </pre> tag]

推荐答案

Ozgur salginci写道:
Ozgur salginci wrote:

< cc1:removed throbberid = "Img3" id ="yukleyici" runat ="server" onupladcompleted ="yukleyici_UploadedComplete" xmlns:cc1 =#unknown">
宽度="100%" EnableViewState ="False"/>

<cc1:removed throbberid="Img3" id="yukleyici" runat="server" onupladcompleted="yukleyici_UploadedComplete" xmlns:cc1="#unknown">
Width="100%" EnableViewState="False" />



看起来这是一个自定义控件.您使用的基本控件是什么?

从页面设计中,您已将文件上载到UpdatePanel中. ASP.NET文件上传控件与更新"面板不兼容,需要完整的回发才能正常工作.因此,如果使用该控件来构建它,则可以尝试将它们放在更新面板之外并进行检查.

如果您无法避免将文件上传放置在UpdatePanel中,请使用Updatepanel的PostbackTrigger进行文件上传.



Looks like this is a Custom Control. What is the base control that you had used?

From your page design, you have placed the fileuploaded inside the UpdatePanel. ASP.NET file upload control is not compatible with Update panel and needs full postback to work properly. So, if that controls is used in order to built it, you might try out placing them outside update panel and check.

If you cant avoid placing the fileupload inside UpdatePanel, then use a PostbackTrigger of Updatepanel for fileuploads.


这篇关于AsyncFileUploader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆