开发者

Setting an asp.net HiddenField from JavaScript callback

So I'm using the awesome jquery plugin -- jQuery Ajax Upload

开发者_高级运维and after a file is uploaded, this code is run:

// Called when upload completed successfully (puts success details into hidden fields)
upload_success_handler: function(file, response) {
    $("input[name$=_filename]", container).val(file.name);
    $("input[name$=_guid]", container).val(response);
    $("#<%=hdnFileName.ClientID %>", container).val(response);
    //I TRIED SETTING THE ACTUAL CLIENT ID, BUT STILL NO
    $("ctl00$MainContent$hdnFileName", container).val(response);
    $("ctl00_MainContent_hdnFileName", container).val(response);        
    $("span[id$=_completedMessage]", container).html("Uploaded <b>{0}</b> ({1} KB)"
                .replace("{0}", file.name)
                .replace("{1}", Math.round(file.size / 1024))
            );
    width = 0;
},

The response is coming from an HTTP handler which saves the file and then shoots it off to flickr and the response is a Photo Id. This all works great, but I can't get my asp.net HiddenField to get the value of the response.

Does anyone have any idea how to figure this out?

The non-asp.net hidden field values seem to get the response, so I'm assuming I'm just setting the name of the control wrong.

Thansk guys!


$("ctl00_MainContent_hdnFileName", container).val(response)

should be (note #)

$("#ctl00_MainContent_hdnFileName", container).val(response)

This expression should set value to hidden input on client side, but I didn't get what "I can't get my asp.net HiddenField to get the value" actually means?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜