4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 29 Oct 2013, 06:11 AM
Hi Heera,
Please have a look into the following sample code I tried from server side for your scenario.
ASPX:
C#:
Thanks,
Princy.
Please have a look into the following sample code I tried from server side for your scenario.
ASPX:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadComboBox1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAsyncUpload1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AutoPostBack
=
"true"
EmptyMessage
=
"Select"
OnSelectedIndexChanged
=
"RadComboBox1_SelectedIndexChanged"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"All Formats"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"PDF"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"SpreadSheet"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Text"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"JPEG"
/>
</
Items
>
</
telerik:RadComboBox
>
<
br
/>
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
>
</
telerik:RadAsyncUpload
>
C#:
protected
void
RadComboBox1_SelectedIndexChanged(
object
sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
string
filetype = RadComboBox1.SelectedItem.Text;
switch
(filetype)
{
case
"PDF"
:
RadAsyncUpload1.AllowedFileExtensions =
new
string
[] {
".pdf"
};
break
;
case
"SpreadSheet"
:
RadAsyncUpload1.AllowedFileExtensions =
new
string
[] {
".xls"
,
".xlsx"
,
".ods"
};
break
;
case
"Text"
:
RadAsyncUpload1.AllowedFileExtensions =
new
string
[] {
".txt"
};
break
;
case
"JPEG"
:
RadAsyncUpload1.AllowedFileExtensions =
new
string
[] {
".jpg"
,
".jpeg"
};
break
;
default
:
RadAsyncUpload1.AllowedFileExtensions =
new
string
[] { };
break
;
}
}
Thanks,
Princy.
0
Sameer
Top achievements
Rank 1
answered on 30 Oct 2013, 08:36 AM
Hello Princy. I was looking for this scenario and found your code. Your code works well in IE but not in Firefox. I am using FireFox 23. Can you please come up with a fix for this?
0
Princy
Top achievements
Rank 2
answered on 30 Oct 2013, 09:56 AM
Hi
Sameer,
By default Firefox is using FileApi module.But FileFiltering will work with Silverlight/flash module only. This is one limitation of the FileApi module. So you need to disable the FileApi module for that please add the following Code to the JavaScript.
JavaScript:
Thanks,
Princy.
By default Firefox is using FileApi module.But FileFiltering will work with Silverlight/flash module only. This is one limitation of the FileApi module. So you need to disable the FileApi module for that please add the following Code to the JavaScript.
JavaScript:
<script type=
"text/javascript"
>
Telerik.Web.UI.RadAsyncUpload.Modules.FileApi.isAvailable =
function
() {
return
false
; }
</script>
Thanks,
Princy.
0
Sameer
Top achievements
Rank 1
answered on 30 Oct 2013, 01:04 PM
Thanks. It worked great.