简体   繁体   中英

Get value from page when using ajaxfileupload with c#

I'm using the ajaxfileupload from ajaxtoolkit. It sits inside a panel attached to the ajaxpanelextender. It works fine. I click a link inside a grid row which fires a javascript event and the panel pops up with the fileupload control.

function EditInspection(link) {
    // Need to get the inspection id from code behind.
    _InspectionID = link.parentNode.parentNode.cells[0].innerText;
    var id = document.getElementById("ContentPlaceHolder1_InspID");
    id.setAttribute('value', _InspectionID);
    var modal = $('.pop')
    modal.trigger('click');
}

"InspID" is an asp:hidden control inside the panel.

I select my files and click upload to get to the UploadComplete event in C#. Once I'm there I need to get a value from the InspID field. But when I get to the line

string sID = InspID.Value;

the value is always an empty string. I also tried using a regular input but the text value is also an empty string. I also tried putting the InspID control outside the panel with the same results. I looked at the API documentation and it had something specifially for passing data - context keys - but from what I've read, it's not implementd. I can't change the source code either to implement anything.

How can I set a value from the javascript call and retrieve it from the code behind?

Thank you.

Earlier it was possible so:

var id = document.getElementById("<%=InspID.CLientID%>");

When the toolkit passed to DevEx ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM