RadBinary Image control

11 posts, 0 answers
  1. Chom
    Chom avatar
    56 posts
    Member since:
    Dec 2009

    Posted 17 Feb 2010 Link to this post

    Hi all

    I want to use the RadBinary image control in my app but I cannot find anything on how to limit the size of the file to be uploaded.

    what I need to do is limit the size of images to be uploaded to less than 5mb.

    Has anyone had any experience with this?

    Thanks

    chommy
  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 18 Feb 2010 Link to this post

    The RadBinary control is not used for uploading images, but for displaying images from the database. If you want to limit the file size of uploaded files you would use the RadUpload control and set the MaxFileSize to 5MB. The MaxFileSize is entered in bytes so you'll need to find that out.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chom
    Chom avatar
    56 posts
    Member since:
    Dec 2009

    Posted 18 Feb 2010 Link to this post

    Thanks for that info on the upload control.

     I was looking more at the BinaryImage/ Binary Images and Upload in Grid demo:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=binaryimage
    to see if there is a way to limit file size. I see that there is a radupload control in the edit mode of the grid, but I cannot figure out how to get to it.

  5. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 18 Feb 2010 Link to this post

    Sorry about that. The way to access the RadUpload control used in edit mode for the RadBinaryColumn is to handle the ItemCreated event of the RadGrid control. In the demo you provided they show the way to access the RadUpload control, so if so look at the code-behind of the demo page, they handle the ItemCreated event and the RadUpload control used by the editor is called RadUploadControl. So you should be able to set the MaxFileSize for the RadUploadControl in that event.

    Below is the event I mention and how to access the RadUploadControl:

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
            { 
                if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
                { 
                    GridBinaryImageColumnEditor editor = ((GridEditableItem)e.Item).EditManager.GetColumnEditor("Upload"as GridBinaryImageColumnEditor; 
                    TableCell cell = (TableCell)editor.RadUploadControl.Parent; 
                    CustomValidator validator = new CustomValidator();  
                    validator.ErrorMessage = "Please select file to be uploaded"
                    validator.ClientValidationFunction = "validateRadUpload"
                    validator.Display = ValidatorDisplay.Dynamic; 
                    cell.Controls.Add(validator); 
                } 
            } 


    I hope that helps.
  6. Chom
    Chom avatar
    56 posts
    Member since:
    Dec 2009

    Posted 19 Feb 2010 Link to this post

    Thanks for your help.

    I got it figured.
  7. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 31 Jul 2010 Link to this post

    I have tried the above method, and the upload control still does not limit filesize in any way.

    What am I missing?

    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
        Dim editor As GridBinaryImageColumnEditor = TryCast(DirectCast(e.Item, GridEditableItem).EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor)
        editor.RadUploadControl.MaxFileSize = 1024
     
    End If
  8. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 05 Aug 2010 Link to this post

    Hello Clayton,

    Bellow link explains in details how to control uploaded files content size:
    http://www.telerik.com/help/aspnet-ajax/upload_uploadinglargefiles.html

    Regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Clayton
    Clayton avatar
    47 posts
    Member since:
    Nov 2009

    Posted 05 Aug 2010 Link to this post

    Hello Nikolay,
    I do not understand how to apply this setting to something like a Radbinary image control in a grid. How can I access the radupload control inside of that?
  10. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 11 Aug 2010 Link to this post

    Hello Clayton,

    There seems to be a bug introduced with latest version of RadGrid. Setting the properties as in your previous post should be working correctly. However the validation for size will fail and will not prevent file from being uploaded.

    We will need some more time to investigate this behavior. I will update this post as soon as fix is provided.

    All the best,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Milind Raje
    Milind Raje avatar
    37 posts
    Member since:
    May 2010

    Posted 19 Nov 2010 Link to this post

    How does one display an image from the database in free format instead of a grid? The GridBinaryImageColumn is available only in RadGrid.
    thanks
    milind
  12. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 22 Nov 2010 Link to this post

    Milind Raje,

    You can use RadBinaryImage as separate control. For more details please check the ItemTemplate of following demo:
    http://demos.telerik.com/aspnet-ajax/binaryimage/examples/default/defaultcs.aspx

    Regards,
    Nikolay
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017