JavaScript, ASP, and VB :)

J

JimmyFo

Hi, this is a bit complicated but maybe someone can help here. I have
an ASP.Net 2.0 page with a JavaScript file selector. I did this because
I wanted to be able to select multiple files at a time. Here's a quick
preview of the JS and ASP to show you what it looks like:

ASP

<td style="width:30%"><asp:FileUpload ID="fileBox" runat="server" />
<asp:Button ID="grabFile" Text="Submit" runat="server"
/></td>
<td style="width:70%">
<div id="files_list"></div></td>

JAVASCRIPT

function initFileUpload(){
//Create an instance of the multiSelector class, pass it the output
target and the max number of files
var multi_selector = new MultiSelector( document.getElementById(
'files_list' ), 5 );
//Pass in the file element
multi_selector.addElement( document.getElementById( 'fileBox' ) );
}

....
....

/**
* Add a new file input element
*/
this.addElement = function( element ){

....

// Add reference to this object
element.multi_selector = this;

// What to do when a file is selected
element.onchange = function(){
if(!element.block)
{
element.block = true;
// New file input
var new_element = document.createElement( 'input' );
new_element.type = 'file';
// Add new element
this.parentNode.insertBefore( new_element, this );
// Apply 'update' to element
this.multi_selector.addElement( new_element );

// Update list
this.multi_selector.addListRow( this );

....

/**
* Add a new row to the list of files
*/
this.addListRow = function( element ){
// Row div
var new_row = document.createElement( 'div' );
// Delete button
var new_row_button = document.createElement( 'input' );
new_row_button.type = 'button';
new_row_button.value = 'Delete';
// References
new_row.element = element;[/code]


Now, what I would like to do is to get that list of elements (I can
store it as an array in one variable if need be) in the VB codebehind
on that button click. Is there a way to do that? When the button is
clicked, I need to access that JS filelist/array and bring it into the
VB codebehind.

Any help is apprecaited!
Thanks,
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top