views:

11

answers:

0

Markup:

<asp:UpdatePanel ID="detailsUpdatePanel" runat="server" >
<ContentTemplate>
    <asp:HiddenField ID="detailsPopupOpening" runat="server" Value="false" />
    <ajax:AsyncFileUpload runat="server" ID="upload" OnUploadedComplete="OnUploadComplete" />
    <asp:Button ID="buttonSave" runat="server" OnClick="OnUpdate" UseSubmitBehavior="False" Text="Save" />
</ContentTemplate>
</asp:UpdatePanel>

Fragment of CB:

    public void FileUploaded(object sender, DataObjectIdEventArgs e)
    {
        AttachmentId = e.DataObjectId;
    }

    public long? AttachmentId
    {
        get
        {
            var attachmentIdHidden = notesEditableList.
                                         FindControl("attachmentIdHidden") as HtmlInputHidden;

            return Int64.Parse(attachmentIdHidden.Value);
        }
        set
        {
            var attachmentIdHidden = notesEditableList.
                                         FindControl("attachmentIdHidden") as HtmlInputHidden;

            attachmentIdHidden.Value = value.HasValue
                                           ? value.Value.ToString()
                                           : String.Empty;

            ViewState["att"] = value;
        }
    }

On buttonSave click calls method:

    public override Note GetDataObject()
    {
        var aI = ViewState["att"];

        return new Note
                   {
                       Id = notesEditableList.EditedObjectId,
                       Version = notesEditableList.EditedObjectVersion,
                       Attached = Presenter.GetAttachmentById(AttachmentId)
                   };
    }

It possible to see that aI == null and AttachmentId == null. Looks like data is not passed to the client. But I tried to set UpdatePanel's UpdateMode to Conditional and call updating by myself but it doesn't work. I even tried to update panel in js using __doPostBack.