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;
     rbiImagem.DataBind();


    But the image still showing up...

    Any idea?

    Thanks...
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 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.

    Regards,
    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. UI for ASP.NET Ajax is Ready for VS 2017
  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
    Admin
    Nikolay Rusev avatar
    2284 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] { };
    BI.DataBind();


    All the best,
    Nikolay
    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) {}
    Else
      RadBinaryImage1.DataValue =  .PictureSmall
    End If
    RadBinaryImage1.DataBind()
    (.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
    Admin
    Vasil avatar
    1547 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;
    image.Visible=false;

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

    Regards,
    Vasil
    Telerik
    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.

    Erik
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017