RadBinaryImage in ServerControl

4 posts, 0 answers
  1. Adam Nelson
    Adam Nelson avatar
    48 posts
    Member since:
    Mar 2008

    Posted 03 Aug 2009 Link to this post

    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

     

  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 06 Aug 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam Nelson
    Adam Nelson avatar
    48 posts
    Member since:
    Mar 2008

    Posted 06 Aug 2009 Link to this post

    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.
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 07 Aug 2009 Link to this post

    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.
Back to Top