Reset RadBinaryImage

7 posts, 0 answers
  1. Luciano Kaesemodel
    Luciano Kaesemodel avatar
    26 posts
    Member since:
    Apr 2007

    Posted 28 Aug 2009 Link to this post

    Hello guys...
    How can I reset a RadBinaryImage (to show no image at all) ?

    I tried that: 

     rbiImagem.DataValue = null;

    But the image still showing up...

    Any idea?

  2. Georgi Krustev
    Georgi Krustev avatar
    3687 posts

    Posted 02 Sep 2009 Link to this post

    Hello Luciano,

    The required functionality is not supported by the current version of the RadControls for ASP.NET AJAX.
    It will be included in Beta release of our controls which is scheduled for the middle of October. The official release is in the beginning of the November.

    Georgi Krustev
    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
  4. Alastair Hole
    Alastair Hole avatar
    4 posts
    Member since:
    Feb 2009

    Posted 16 Feb 2011 Link to this post

    Has this been implemented? I can't get it to work...
  5. Nikolay Rusev
    Nikolay Rusev avatar
    2275 posts

    Posted 22 Feb 2011 Link to this post

    Hello Alastair,

    You can bind RadBinaryImage to empty byte array which will result in clearing the image.
    BI.DataValue = new byte[0] { };

    All the best,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  6. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 24 Jan 2014 Link to this post

    Hi all,

    This is actually not working in VB.NET. If I do this:

    If bln_New Or .PictureSmall Is Nothing Then
      RadBinaryImage1.DataValue = New Byte(0) {}
      RadBinaryImage1.DataValue =  .PictureSmall
    End If
    (.PictureSmall is a blob in my OpenAccess model, type: Byte() Backend SQL Server)

    Now, when a record has no PictureSmall set  (db = NULL, model = nothing) I get an error:
      The provided binary data may not be valid image or may contains unknown header
    This error accours somewhere down the tree, while rendering I guess, in the page_OnError.

    I tried a few different things: 
      RadBinaryImage1.DataValue = New Byte(0) {0}
      RadBinaryImage1.DataValue = Nothing

    The first gives the error again, and the second just shows the previous image if this record does not have and image

    A RadBinaryImage1.Clear would be a handy feature...

    How can I clear the image?

  7. Vasil
    Vasil avatar
    1540 posts

    Posted 27 Jan 2014 Link to this post

    Hello Erik,

    Depends what is your goal. What you mean by reset the image? By default there is no image, but you will get exception that you need valid data in order to display.

    For going to the original state of the RadBinaryImage you can use something like:

    image.DataValue = null;
    image.ImageUrl = "";
    image.HttpHandlerUrl = "";
    //another option:
    image.PersistDataIfNotVisible = false;

    If you don't want to show image at all, I would suggest you to simply set Visible=false.

    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  8. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 28 Jan 2014 in reply to Vasil Link to this post

    Hi Vesil,

    Yes, thanks, image.ImageUrl = "" will do the trick for me. Thanks.

Back to Top
DevCraft R3 2016 release webinar banner