Welcome Guest Search | Active Topics | Sign In | Register

AJAX Uploader Options
Dekaiden
Posted: Thursday, October 30, 2008 6:26:56 PM
Rank: Member
Groups: Member

Joined: 10/28/2008
Posts: 12
Good Evening,

First off I want to say I have looked everywhere online and tested MANY file uploaders and so far, this is the best one I've found. I do have some questions about it and I hope you can help me:

First off, I would like to be able to add a link that will dynamically add more boxes for the users to upload more content. I tried to use a LinkButton and use CodeBehind to achieve this with the following code:

(Handles lbAdd.Click)
Code: Visual Basic.NET
Uploader1.MaxFileCount = Uploader1.MaxFileCount + 1

I've also tried hard coding it to be set to 2 or 5 or whatever, regardless it doesn't do anything. No error, no added boxes, not anything to go off of.

Cosmetically, I would like to add a Panel to the AJAX Uploader that has the progress bar and Cancel button in it. When you click upload, the Panel goes from not visible to visible and upon completion of the upload, the panel become invisible again.

One last thing I can think of currently that I'm having trouble with: I noticed the ClientSideEvents (ClientSideOnDone, etc) only support JavaScript. There's a few things I would like to do with these, however, I'm not too good with JavaScript. So, is there a way I can use JavaScript to call a Subroutine in my aspx.vb page? Will there be any future support for these events to be handled by ASP.NET Subroutines?

Thank you in advance for you help!


Respectfully,
Stephen
eo_support
Posted: Thursday, October 30, 2008 7:19:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Thanks for contacting us. As to your questions:

1. You would need to set Uploader1.Row instead of Uploader1.MaxFileCount;

2. That's where you would need to use ClientSideOnStart and ClientSideOnEnd. You will also need to change the uploader's LayoutTemplate. I would suggest you try out these two features separately. Once you know how each of them works, you can then put them together.

To use ClientSideOnStart and ClientSideOnEnd, you would do something like this:

Code: HTML/ASPX
<script type="text/javascript">
function on_uploader_start()
{
    document.getElementById("some_div").style.display = "block";
}

function on_uploader_done()
{
    document.getElementById("some_div").style.display = "none";
}
</script>

<div id="something" style="display:none">
some text
</div>

<eo:AJAXUploader 
    ClientSideOnStart="on_uploader_start" 
    ClientSideOnDone="on_uploader_done" ...>
....
</eo:AJAXUploader>


The above code includes three parts. The second part is a panel that you want to show/hide when the uploader starts/ends. The third part is the uploader. The first part is the necessary JavaScript code that glues the second and the third part together.

The uploader's LayoutTemplate is a totally separate feature. You can check the documentation for more detail on that. There is also a sample in the sample package demonstrating how to use it. The purpose of the feature is to allow you to customize the uploader's layout to whatever way you'd like.

3. Server side code and client side JavaScript are for different purposes. Some work can be done on either side, but some can only be done on the server side, and some can only be done on the client side or have serious performance implication if you choose to do it on the server side. For example, if you wish a red button to turn blue when mouse hovers over it, you will need to use either CSS or client side JavaScript. Server side code is absolutely not an option in this case.

A lot of times, we provide both server side and client side interface for the same functionalities and let the user to choose whichever that fits their situation best. For example, you can handle a menu item click event both on the client side with JavaScript or in the server side code. However some client side events do not have server side equivalent because it doesn't make sense to perform their action on the server side. ClientSideOnStart and ClientSideOnEnd are among these. If you are not familiar with JavaScript, you can just copy and paste our sample code. Those should get you started. JavaScript is quite easy to get started.

Hope this helps.

Thanks
Dekaiden
Posted: Thursday, October 30, 2008 8:15:32 PM
Rank: Member
Groups: Member

Joined: 10/28/2008
Posts: 12
Good Evening.

I am very impressed with how quickly and accurately you answered my questions. This is exactly what I was looking for.

Thank you again!


Respectfully,
Stephen
eo_support
Posted: Thursday, October 30, 2008 8:24:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Glad to hear that! Please feel free to let us know if you have any more questions.
Dekaiden
Posted: Thursday, October 30, 2008 9:10:34 PM
Rank: Member
Groups: Member

Joined: 10/28/2008
Posts: 12
Have another question: :P

I'm using the AJAX Uploader in a "LightBox" type setting. I want there to be a link and when you click the link, it adds another row for the users to be able to upload more than one file at a time. I used the code you gave me previously on a test project and it worked beautifully. However, I used it in a Subroutine and this causes a PostBack. In the project where I'm using the "LightBox" Method, if I do a PostBack then the "LightBox" disappears again. Is there another way I can approach this? Can I add and remove rows through JavaScript?
eo_support
Posted: Thursday, October 30, 2008 9:50:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It won't be as easy as that. :) There is no equivalent of the Row property on the client side, so you will always need a postback. You do have the option of performing a full page postback or a partial page postback. The later is where AJAX comes into play. We have a CallbackPanel control specifically for that purpose. The control allows you to update a portion of your page, instead of the whole page via postback. Our sample project should give you a good idea about how it would look like: All the demos are AJAX loaded by our CallbackPanel control. You will notice that only the demo area is updated when you choose a demo from the TreeView on the left side.

This page contains a quick start guide about how to use our CallbackPanel control:

http://www.essentialobjects.com/ViewDoc.aspx?t=Callback%2fwalkthru_productInfo.html

If you use ASP.NET 2.0, you can also use ASP.NET AJAX UpdatePanel. It works very similar to our CallbackPanel. You should be able to find out plenty of information about UpdatePanel online.

BTW: If you have a different question, it's better for you to start a new thread. Keeping different questions in separate thread helps us to better track open issues (so that closing a question in one thread won't close all questions) and also help other users to search for answers in the forum.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.