Welcome Guest Search | Active Topics | Sign In | Register

ClientSideOnError example needed for extension_not_allowed - Ajax Uploader Options
Nuno Nogueira
Posted: Monday, February 28, 2011 9:29:28 AM
Rank: Member
Groups: Member

Joined: 2/24/2011
Posts: 25
Hello
I would get an example of resource usage ClientSideOnError when selecting the file to upload is not compatible with TXT or RAR files.

Can anyone help me?

Here is my code:

<eo:AJAXUploader ID="AJAXUploader1" runat="server"
ProgressTextFormat="Carregando...{transferred} bytes de {total} bytes ({percentage}%) carregado."
TempFileLocation="c:\temp" Width="285px" AllowedExtension=".txt|.rar"
AutoPostBack="True" ClientSideOnError="extension_not_allowed">
<LayoutTemplate>
<table border="0" cellpadding="2" cellspacing="0" width="250px">
<tr>
<td>
<asp:PlaceHolder runat="server" id="InputPlaceHolder">Input Box Place Holder
</asp:PlaceHolder>
</td>
</tr>
<tr>
<td align="center" style="text-align: center">
<asp:Button runat="server" ID="UploadButton" Text="Iniciar análise" />
</td>
</tr>
<tr>
<td>
<eo:ProgressBar runat="server" id="ProgressBar" ControlSkinID="Windows_XP" />
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder runat="server" id="ProgressTextPlaceHolder">Progress Text Place Holder
</asp:PlaceHolder>
</td>
</tr>
<tr>
<td align="center" style="text-align: center">
<asp:Button runat="server" ID="CancelButton" Text="Cancelar" />
</td>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td align="right">
&nbsp;</td>
</tr>
</table>
</LayoutTemplate>
</eo:AJAXUploader>
eo_support
Posted: Monday, February 28, 2011 10:01:17 AM
Rank: Administration
Groups: Administration

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

It would be something like this:

Code: JavaScript
function extension_not_allowed(control, error, message)
{
    if (error == "extension_not_allowed")
    {
        .....your error handling code here.....
    }
    else
    {
        //display the default message
        alert(message);
    }
}


Hope this helps.

Thanks
Nuno Nogueira
Posted: Monday, February 28, 2011 11:20:04 AM
Rank: Member
Groups: Member

Joined: 2/24/2011
Posts: 25
eo_support wrote:
Hi,

It would be something like this:

Code: JavaScript
function extension_not_allowed(control, error, message)
{
    if (error == "extension_not_allowed")
    {
        .....your error handling code here.....
    }
    else
    {
        //display the default message
        alert(message);
    }
}


Hope this helps.

Thanks


Used the example that I passed and still opening the same dialog box saying in English to set the clientsideonerror to handle this error.

What am I doing wrong?

Thanks
eo_support
Posted: Monday, February 28, 2011 11:24:31 AM
Rank: Administration
Groups: Administration

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

Please try to understand and troubleshoot the code first. We do not code for you. So if you just try to copy and paste our code without trying to understand it, then we will not be able to help you further. If there is a specific part in our code that you do not understand, then explain which part and why you do not understand. In that case we will be happy to help if it falls into the scope of our support.

Thanks!
Nuno Nogueira
Posted: Monday, February 28, 2011 11:40:37 AM
Rank: Member
Groups: Member

Joined: 2/24/2011
Posts: 25
eo_support wrote:
Hi,

Please try to understand and troubleshoot the code first. We do not code for you. So if you just try to copy and paste our code without trying to understand it, then we will not be able to help you further. If there is a specific part in our code that you do not understand, then explain which part and why you do not understand. In that case we will be happy to help if it falls into the scope of our support.

Thanks!




Well, I understood that I must set the parameter ClientSideOnerror: ClientSideOnError = "extension_not_allowed"

and within the tag: eo:ajaxuploader1 in my aspx code.


And so I sent it, create a javascript as the model that gave me:

<script type="text/javascript" language="javascript">
extension_not_allowed function (control, error, message)
{
if (error == "extension_not_allowed)
{
..... your error handling code here .....
}
else
{
/ / display the default message
alert (message);
}
}
</ script>

I use MasterPage, in this case your upload control is within a webcontent (content2), which also put this example that you cited.

Well, I do like to understand how to convey a message such as: Invalid file type, please select only TXT or RAR.

This is part of its support?
Nuno Nogueira
Posted: Monday, February 28, 2011 11:45:18 AM
Rank: Member
Groups: Member

Joined: 2/24/2011
Posts: 25
Nevermind, I managed to solve. Thanks anyway.


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.