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

Reset RadBinaryImage

6 Answers 313 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Luciano Kaesemodel
Top achievements
Rank 1
Luciano Kaesemodel asked on 28 Aug 2009, 01:50 PM
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...

6 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 02 Sep 2009, 03:47 PM
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.
0
Alastair Hole
Top achievements
Rank 1
answered on 16 Feb 2011, 06:50 PM
Has this been implemented? I can't get it to work...
0
Nikolay Rusev
Telerik team
answered on 22 Feb 2011, 12:53 PM
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!
0
Erik
Top achievements
Rank 2
answered on 24 Jan 2014, 05:12 PM
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?



0
Vasil
Telerik team
answered on 27 Jan 2014, 01:38 PM
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.
0
Erik
Top achievements
Rank 2
answered on 28 Jan 2014, 02:39 PM
Hi Vesil,

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

Erik
Tags
BinaryImage
Asked by
Luciano Kaesemodel
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Alastair Hole
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Erik
Top achievements
Rank 2
Vasil
Telerik team
Share this question
or