Search code examples
c#webformsajaxcontroltoolkitjsajaxfileuploader

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.


Solution

  • Earlier it was possible so:

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

    When the toolkit passed to DevEx ...