I have an aspx page head section containing the following javascript function:
<script type="text/javascript">
function addFile() {
var table = document.getElementById("filesTable");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = document.getElementById('hImageLoc');
cell2.innerHTML = document.getElementById("hFileName");
}
</script>
I got the code from a site called aspsnippets.
The hImageLoc
and hFileName
are both asp:Hidden
fields on the aspx page. The user selects a file from a FileUpload
control and then clicks an upload button (asp:Button
). In the code behind (VB.Net) I have some code which saves the file and this works fine.
After the code has processed this far, and the file has been saved, I want to call the JavaScript function above, which will add a line to an HTML table with the name and document type.
I just can't seem to figure out how to call the JavaScript at that point in the VB code. Can someone point to an article or place that would have a clear example of how to do this?