views:

106

answers:

1

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!

+1  A: 
$("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?

Roman
Just poorly worded on my part. Basicaly I was able to set regular hidden fields, but not asp.net hidden fields. i'll try your additon of #
Jack Marchetti
There is no significant difference between regular and asp.net hidden fields. Asp.net hidden field has corresponding Control at server side which grabs the value when **PostBack** occurs, so I do not still understand why you are experiencing some problems with asp.net hidden field. Try provide more info.
Roman