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

RadBinaryImage in ServerControl

3 Answers 174 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Adam Nelson
Top achievements
Rank 2
Adam Nelson asked on 03 Aug 2009, 10:10 PM
Is this possible??

I have a server control which renders a div, and inside the div I want to display the "avatar" for the supplied object.

Simplified example of the RenderContents method of the server control.

 

        protected override void RenderContents(HtmlTextWriter writer)  
        {  
            writer.RenderBeginTag(HtmlTextWriterTag.Div);  
 
            RadBinaryImage image = new RadBinaryImage();  
            image.DataValue = customer.Avatar; //byte array  
            image.Width = image.Height = Unit.Pixel(80);  
            image.AlternateText = customer.Name;  
            //image.DataBind();  
            image.RenderControl(writer);  
            writer.WriteLine();

            writer.RenderEndTag();

        } 

 

When the control is rendered on the page, the image shown is the browsers default image not found placeholder. I know the customer object being used in the test has an avatar specified so the DataValue property should be set correctly. 

I tried calling databind also because all the examples show it being used in a databound control, but that didnt seem work either.

Let me know if I'm doing something wrong or if this is just not supported.

Thanks,

Adam

 

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 06 Aug 2009, 03:18 PM
Hello Adam,

I am afraid that I was not able to replicate described issue.
For your convenience I've prepared sample project. Please find it attached to this post.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adam Nelson
Top achievements
Rank 2
answered on 06 Aug 2009, 08:37 PM
I tried the sample application, and got the same image not found result..

I then added a RadBinaryImage control to the markup of the page, and set the DataValue the same way its being set in the server control...(creates a memory stream of an image from file)...

The RadBinaryImage on the page renders correctly, the one within the server control does not.

I can send the modified sample back if necessary and some screenshots....

I first thought this was a file permission issue, but it doesnt look like thats the case since one renders and the other does not. I'm beginning to believe its just not something that is supported at this time and will submit a feature request if that is the case.
0
Nikolay Rusev
Telerik team
answered on 07 Aug 2009, 03:09 PM
Hello Adam,

The sample project that I send you in my previous post is working properly on my end. Can you please ensure that you haven't disable any http handlers. This might be a reason for not streaming the image.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
BinaryImage
Asked by
Adam Nelson
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
Adam Nelson
Top achievements
Rank 2
Share this question
or