Hi ,
I have a file upload control in my rad grid editformtemplate and the posted file has to be saved on the click of a button
inside the template . The code for this has been placed inside the ItemCommand . The ItemCommand fires when i upload files with filenames having no special character or spaces between them , but when i try for files having special character or spaces between them
the event is not fired and the IE displays page cannot be found . Any Idea on why this happens.
.ASPX CODE:
<EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn">
</EditColumn>
<FormTemplate>
<table id="tableSupportingFilesTemplate" cellspacing="2" cellpadding="1" width="100%"
border="0" rules="none" style="border-collapse: collapse; background: white;">
<tr>
<td width="2%">
</td>
<td colspan="3">
<asp:CheckBox ID="checkBoxVisibleFiles" Enabled="false" runat="server" Checked='<%# (DataBinder.Eval(Container.DataItem,"VisibleToCustomer") is DBNull ?false:Eval("VisibleToCustomer")) %>'
Text="Visible to the Customer/Prospect?" />
</td>
</tr>
<tr>
<td width="2%">
</td>
<td colspan="3">
<asp:Label ID="labelFileText" runat="server" Text="File Name : "> </asp:Label>
<asp:Label ID="labelFileName" Text='<%# Bind("OriginalFileName") %>' runat="server"></asp:Label>
</td>
</tr>
<tr>
<td width="2%">
</td>
<td colspan="3">
<asp:FileUpload ID="fileUploadControl" runat="server" Width="50%" />
</td>
</tr>
</table>
<FormTemplate>
.CS CODE
ITEMCOMMAND EVENT
if (e.CommandName == "Insert")
{
if (e.Item is GridEditFormInsertItem)
{
FileUpload fileUploadCtrl = (FileUpload)insertFormItem.FindControl("fileUploadControl");
if (fileUploadCtrl.HasFile == true)
{
try
{
string fileName = Path.GetFileName(fileUploadCtrl.FileName);
fileUploadCtrl.SaveAs(System.Configuration.ConfigurationSettings.AppSettings["FilePath"].ToString() + "/" + GenerateRandomFileName(fileUploadCtrl));
}
catch (Exception ex)
{
}
regards
Ratheesh