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

NestedViewTemplate GridBinaryImageColumn Image not showing

3 Answers 81 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 24 Oct 2012, 06:59 PM


I have to identical RadGrid's. I created the Radgrid and then placed it in a nested view. The image show up in the first table but not the nested. What am I missing?

FIrst Table:

<telerik:RadGrid ID="RadGrid6" runat="server"
                 DataSourceID="PictureDB" AutoGenerateColumns="False" AllowSorting="True"
                 AllowPaging="True" PageSize="5" GridLines="None"
                 ShowGroupPanel="True" CellSpacing="0" AllowFilteringByColumn="True">
    <ClientSettings>
        <Selecting CellSelectionMode="None"></Selecting>
    </ClientSettings>
 
    <MasterTableView
        DataKeyNames="PictureID"
        DataSourceID="PictureDB" AllowFilteringByColumn="False">
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
 
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
 
        <Columns>
            <telerik:GridBoundColumn DataField="PictureID" DataType="System.Int32"
                                     FilterControlAltText="Filter PictureID column"
                                     HeaderText="PictureID" SortExpression="PictureID"
                                     UniqueName="PictureID" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Extension"
                                     FilterControlAltText="Filter Extension column" HeaderText="Extension"
                                     SortExpression="Extension" UniqueName="Extension">
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn DataField="IsNew" DataType="System.Boolean"
                                        FilterControlAltText="Filter IsNew column" HeaderText="IsNew"
                                        SortExpression="IsNew" UniqueName="IsNew">
            </telerik:GridCheckBoxColumn>
            <telerik:GridBoundColumn DataField="SKU"
                                     FilterControlAltText="Filter SKU column"
                                     HeaderText="SKU" SortExpression="SKU"
                                     UniqueName="SKU">
            </telerik:GridBoundColumn>
        </Columns>
 
        <Columns>
            <telerik:GridBinaryImageColumn DataField="PictureBinary"></telerik:GridBinaryImageColumn>
        </Columns>
 
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
    </MasterTableView>
 
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>


 Here is the table with nested view:

<telerik:RadGrid ID="RadGrid1"  DataSourceID="DataSourceMP"
                 runat="server" AutoGenerateColumns="False" AllowSorting="True"
                 AllowPaging="True" PageSize="5" GridLines="None"
                 ShowGroupPanel="True" CellSpacing="0" AllowFilteringByColumn="True">
    <PagerStyle Mode="NumericPages"></PagerStyle>
    <MasterTableView DataSourceID="DataSourceMP" AllowMultiColumnSorting="True"
                     GroupLoadMode="Server">
             
        <NestedViewTemplate>
 
            <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">
                <Tabs>
                    <telerik:RadTab runat="server" Text="Pricing" PageViewID="PageView1">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Online Detail" PageViewID="PageView2">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Images" PageViewID="PageView3">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
 
            <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                <telerik:RadPageView runat="server" ID="PageView1">
                            
                    <%--this an a master table--%>
 
 
                    <%--this an a master table End--%>
 
                </telerik:RadPageView>
                <telerik:RadPageView runat="server" ID="PageView2" Width="460px">
                     
                    <%--this an a master table--%>
 
 
 
                    <%--this an a master table End--%>
 
 
                </telerik:RadPageView>
                <telerik:RadPageView runat="server" ID="PageView3">
 
 
                    <%--this an a master table--%>
                    <asp:Label ID="Label3" Font-Bold="true" Font-Italic="true" Text='<%# Eval("Item_Number") %>'
                               Visible="false" runat="server"></asp:Label>
 
 
                    <telerik:RadGrid ID="RadGrid5" runat="server"
                                     DataSourceID="PictureDB" AutoGenerateColumns="False" AllowSorting="True"
                                     AllowPaging="True" PageSize="5" GridLines="None"
                                     ShowGroupPanel="True" CellSpacing="0" AllowFilteringByColumn="True">
                        <ClientSettings>
                            <Selecting CellSelectionMode="None"></Selecting>
                        </ClientSettings>
 
                        <MasterTableView
                          DataKeyNames="PictureID"
                            DataSourceID="PictureDB" AllowFilteringByColumn="False">
                            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                     
                            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                     
                            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                     
                            <Columns>
                                <telerik:GridBoundColumn DataField="PictureID" DataType="System.Int32"
                                                         FilterControlAltText="Filter PictureID column"
                                                         HeaderText="PictureID" SortExpression="PictureID"
                                                         UniqueName="PictureID" ReadOnly="True">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Extension"
                                                         FilterControlAltText="Filter Extension column" HeaderText="Extension"
                                                         SortExpression="Extension" UniqueName="Extension">
                                </telerik:GridBoundColumn>
                                <telerik:GridCheckBoxColumn DataField="IsNew" DataType="System.Boolean"
                                                            FilterControlAltText="Filter IsNew column" HeaderText="IsNew"
                                                            SortExpression="IsNew" UniqueName="IsNew">
                                </telerik:GridCheckBoxColumn>
                                <telerik:GridBoundColumn DataField="SKU"
                                                         FilterControlAltText="Filter SKU column"
                                                         HeaderText="SKU" SortExpression="SKU"
                                                         UniqueName="SKU">
                                </telerik:GridBoundColumn>
                            </Columns>
                     
                            <Columns>
                                <telerik:GridBinaryImageColumn DataField="PictureBinary"></telerik:GridBinaryImageColumn>
                            </Columns>
                   
                          <EditFormSettings>
                              <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                          </EditFormSettings>
                      </MasterTableView>
 
                        <FilterMenu EnableImageSprites="False"></FilterMenu>
                    </telerik:RadGrid>
                     
 
                    <%--this an a master table End--%>
 
                </telerik:RadPageView>
            </telerik:RadMultiPage>
 
        </NestedViewTemplate>
 
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
 
 
    </MasterTableView>
    <ClientSettings AllowDragToGroup="false">
        <Selecting CellSelectionMode="None"></Selecting>
    </ClientSettings>
 
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 29 Oct 2012, 08:27 AM
Hello Nick,

Indeed I verified that the described issue exists into the current version of our controls. However our developers are aware and they will start working on the resolution of this issue.  Additionally at a meantime you could try using the following workaround:
void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
      if (e.CommandName == "ExpandCollapse" && !e.Item.Expanded)
      {
           (((e.Item as GridDataItem).ChildItem as GridNestedViewItem).FindControl("RadGrid5") as RadGrid).Rebind();
      }
}

I hope this helps.

Regards,
Radoslav
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Nick
Top achievements
Rank 1
answered on 31 Oct 2012, 06:56 PM
This worked great! Thank you.

However I am not sure how to add an event handler to the nested table. 

I tried this but it didn't work. The eventhandler works on a RadGrid that is not nested via:

oninsertcommand="ImageCreate_InsertCommand"

Do you know how to get a nested grid's event to fire?

protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
       {
           if (e.CommandName == "ExpandCollapse" && !e.Item.Expanded)
           {
               (((e.Item as GridDataItem).ChildItem as GridNestedViewItem).FindControl("RadGrid5") as RadGrid).InsertCommand += new GridCommandEventHandler(ImageCreate_InsertCommand);
               (((e.Item as GridDataItem).ChildItem as GridNestedViewItem).FindControl("RadGrid5") as RadGrid).Rebind(); 
           }
0
Radoslav
Telerik team
answered on 05 Nov 2012, 09:35 AM
Hello Nick,

To achieve the desired functionality you could try attaching the event on the parent grid’s RadGrid1_ItemCreated event handler. For example:
void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
        GridNestedViewItem item = e.Item as GridNestedViewItem;
        if (item != null)
        {
            (item.FindControl("RadGrid5") as RadGrid). InsertCommand += _Grid_ InsertCommand;
        }
}

Please give it try and let me know if it helps you. Looking forward for your reply.

Greetings,
Radoslav
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
BinaryImage
Asked by
Nick
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Nick
Top achievements
Rank 1
Share this question
or