Problem finding control in a Dynamic Data website

Last post 05-20-2009, 1:04 AM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  05-18-2009, 12:33 PM 52276

    Problem finding control in a Dynamic Data website

    Hello,
     
    I am trying to implement the AjaxUploader control on a custom Insert page in a Dynamic Data (Asp.Net 3.5) website.  I was able to get it working on a custom Edit page.  I am using a FormView, and have been able to use the FindControl function to locate the the Uploader everywhere except in the OnInit method.  The impact is that the UploaderEventHandler is not being added to the uploader.
     
    Here is my code:
     
     protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            FormView1.DefaultMode = FormViewMode.Insert;
            UploadAttachments Uploader1 = (UploadAttachments)FormView1.FindControl("Uploader1");
            try
            {
                lbl_status.Text = "uploader found";
                Uploader1.FileUploaded += new UploaderEventHandler(Uploader_FileUploaded);
            }
            catch
            {
                lbl_status.Text = "not found";
            }
            //btn_cancel.Click += new EventHandler(ButtonPostBack_Click);
        }
  •  05-20-2009, 1:04 AM 52346 in reply to 52276

    Re: Problem finding control in a Dynamic Data website

    If you just want to attach the FileUploaded event,
     
    Can you try to do it at OnLoad ?
     
    Regards
    Terry
     
View as RSS news feed in XML