RADUpload in a grid

Thread is closed for posting
2 posts, 0 answers
  1. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 25 Sep 2009 Link to this post

    Where can i find some examples of using a RADUpload in a grid that doesnt use GridBinaryImageColumn
    Im storing the URL of the image, not the binary contents of the image itself

    The method im using doesnt work as UploadedFiles are always zero, heres how Im trying to make it work, in my grid

    <telerik:GridTemplateColumn HeaderText="Image File" UniqueName="ImageUpload">  
                            <asp:Label ID="LabelImage" runat="server" Text='<%# Eval("FileName") %>'></asp:Label> 
                                    <telerik:RadUpload ID="RadUploadImage" runat="server"   
                                    InitialFileInputsCount="1" MaxFileInputsCount="1" 
                                    ControlObjectsVisibility="None" MaxFileSize="100000"   
                                    AllowedFileExtensions=".jpg,.gif,.jpeg" TargetFolder="~/Uploads"/>  

    and then in my codebehind

    protected void RadGridPanelImages_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
                var editableItem = ((GridEditableItem)e.Item);  
                string thumbURL = string.Empty;  
                string ImageURL = string.Empty;  
                string url = TheCompanyBL.Helpers.GetSiteURL();  
                string ImageUploadURL = url + "/Uploads/";  
                RadComboBox rcb = (RadComboBox)e.Item.FindControl("RadComboBoxPanelID");  
                if (rcb != null)  
                    ip.PanelID = int.Parse(rcb.SelectedValue);  
                    ip.PanelID = -1;  
                int id = -1;  
                RadUpload ru = (RadUpload)e.Item.FindControl("RadUploadImage");  
                if (null != ru)  
                    string target = Server.MapPath(ru.TargetFolder);  
                    string sFileType = ru.UploadedFiles[0].GetExtension(); ---  this generates an error even though I HAVE selected a file  
                            ip.FileName = ru.UploadedFiles[0].FileName;  
                            imagemanager.ResizeAndSave(ru.UploadedFiles[0], ImageUploadURL, target, "PanelImages", true, out thumbURL);  
                            imagemanager.ResizeAndSave(ru.UploadedFiles[0], ImageUploadURL, target, "PanelImages", false, out ImageURL);  
                            ip.ImageURL = ImageURL;  
                            ip.ThumbnailURL = thumbURL;  
                if (!String.IsNullOrEmpty(thumbURL) && !String.IsNullOrEmpty(ImageURL))  
                    string err = panelmanager.Add(ip, out id);  
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 25 Sep 2009 Link to this post

    Hi mww,

    This may occur if you have ajaxified your grid. If this is the case please check this help topic for a resolution.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
Back to Top