Image Not Displaying in Nested Template View

5 posts, 1 answers
  1. Kevin Mauriello
    Kevin Mauriello avatar
    8 posts
    Member since:
    Feb 2010

    Posted 04 May 2010 Link to this post

    I took your example from Grid/Herarchy With Templates, other than the database fields being different the only change I made was to replace:

    <img  src='<%#  Page.ResolveUrl("~/Grid/Examples/Hierarchy/NestedViewTemplate/Img/") + (Container.FindControl("Label1") as Label).Text %>.jpg' alt="Customer Image" />

    with this:
    <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource4"
            <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" 
                DataValue='<%#Eval("Avatar") %>' Width="90px" Height="110px" ResizeMode="Fit"/> 

    I need to retrieve the image from the database.
    The first image is correct, but all images after that fail.  When I modify the PreRender to loop through each item and expand each item it works fine, for the first page (the second page is all empty images).

    I have a feeling this is going to be a dumb mistake by me, please help.

    Here is what it looks like:

  2. Answer
    Rosen avatar
    3247 posts

    Posted 05 May 2010 Link to this post

    Hello Kevin,

    Can you please verify that the RadBinaryImage/its binding container is databound when the NestedViewTemplate is expanded. Also can you please provide a bit more information about the grid's declaration, some code snippets etc.

    Kind regards,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Kevin Mauriello
    Kevin Mauriello avatar
    8 posts
    Member since:
    Feb 2010

    Posted 05 May 2010 Link to this post

    That did it, I put the datalist.databind in the itemcommand event.

  4. Miguel
    Miguel avatar
    25 posts
    Member since:
    Dec 2010

    Posted 28 Jan 2011 Link to this post

    Hello everyone,

    Regarding this issue, how can I reference the Datalist control if it is nested in the the grid. I try to reference it within the code behind and can't get it done. I use advance databind for the Grid and also have to use it for the datalist. In which event should I put my code?

  5. Kiara
    Kiara avatar
    309 posts
    Member since:
    Jul 2006

    Posted 01 Feb 2011 Link to this post

    As with other regular web grid, you should be able to listen for the ItemCreated or ItemDataBound server event and locate your nested datalist using e.Item.FindControl(datalistId) method. Inspect this doc for details about these two telerik grid events.

Back to Top