This is a migrated thread and some comments may be shown as answers.

Image Upload

4 Answers 278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clark
Top achievements
Rank 1
Clark asked on 11 Feb 2011, 04:50 PM
Is it possible to have an image upload control in the insert / update templates? I have a grid i am using to edit / insert sections of a site that includes images and text.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Feb 2011, 05:25 AM
Hello Clark,


The following demo illustrates the usage of built-in GridBinaryImageColumn and how to display and edit images in it.
Binary Images and Upload in Grid


Another demo shown usage of 'RadAsyncUpload '  in grid.
Binary Images and RadAsyncUpload in Grid

Hope this helps.

Thanks,
Princy.
0
Clark
Top achievements
Rank 1
answered on 15 Feb 2011, 09:21 PM
Thanks for the help!
0
Wenting
Top achievements
Rank 1
answered on 05 Apr 2012, 11:54 AM
Hi there

My scenario is that I need to update items in radgrid in "inPlace" mode, and I databind my own datatype to the grid in server side. So I can't use binarycolumn as it has to assign "datafield". So I tried to use upload control inside edititemtemplate, but it didn't work. Every time it called Grid_UpdateCommand, the uploadcontrol.uploadedFiles.count is zero.

Cloud anybody help me? Thank in advance.
<telerik:GridTemplateColumn HeaderStyle-Width="50px" UniqueName="Picture">   
  <HeaderTemplate>   
   <asp:Label ID="Label13"  Text="picture" runat="server"></asp:Label>   
  </HeaderTemplate>   
  <ItemTemplate>   
    <telerik:RadButton ID="RadButton17" runat="server">
     <Icon PrimaryIconCssClass="rbOpen" PrimaryIconLeft="4" PrimaryIconTop="4" />
   </telerik:RadButton>
   </ItemTemplate>  
   <InsertItemTemplate>
   </InsertItemTemplate>
   <EditItemTemplate>
    <telerik:RadUpload ID="RadUpload1" runat="server" ControlObjectsVisibility="None" MaxFileInputsCount="1" MaxFileSize="4194304" TargetFolder="~/Img/Upload" />  
   </EditItemTemplate>     
</telerik:GridTemplateColumn >
 
protected void ProductGrid_UpdateCommand(object sender, GridCommandEventArgs e)
        {
         
            if (pic.UploadedFiles.Count > 0)
            {
                foreach (UploadedFile validFile in pic.UploadedFiles)
                {
                    string targetFolder = Server.MapPath("~/Img/Upload");
                    validFile.SaveAs(Path.Combine(targetFolder, validFile.GetName()), true);
                }
 
            }
            
            
        }
0
Antonio Stoilkov
Telerik team
answered on 10 Apr 2012, 07:49 AM
Hello Wenting,

You could achieve your scenario by following the demo provided below. The idea is to use GridAttachmentColumn, subscribe to RadGrid ItemCommand event and handle the DownloadAttachment command.

All the best,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Clark
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Clark
Top achievements
Rank 1
Wenting
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Share this question
or