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

RadGrid nested in RadListView binding to object

1 Answer 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Legan
Top achievements
Rank 1
James Legan asked on 24 Aug 2010, 08:51 PM
I apologize for posting what amounts to "Can someone help me code this", but after nearly a days worth of effort I have not made much progress. Below are the code snippets I have right now. What I am essentially trying to do is present the user with a RadListView of all of the data objects (this part is work) and nested inside each listing is a grid with the contents of a generic collection of strings.

The class looks like this:

 

 

string _Key;

 

 

 

string _PreferredWindowsStringIdentifier;

 

 

 

string _PreferredUnixStringIdentifier;

 

 

 

List<TestAutomationWebservice.Translations> _Strings;

 

 

 

int _Count;

 


And there is a collection of these objects (generic List<>).

Below is the code for the RadListView (with a nested RadListView that displays the data I am trying to get into the grid).

<asp:Panel ID="Panel1" runat="server">
        <telerik:RadListView ID="RadListView1" Width="97%" AllowPaging="True" runat="server"
            AllowSorting="true" DataKeyNames="Key" ItemPlaceholderID="ProductsHolder">
            <LayoutTemplate>
                <fieldset style="width: 760px;" id="FieldSet1">
                    <legend>Duplicate Strings</legend>
                    <asp:Panel ID="ProductsHolder" runat="server" />
                    <table cellpadding="0" cellspacing="0" width="100%;" style="clear: both;">
                        <tr>
                            <td>
                                <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
                                    PageSize="30">
                                    <Fields>
                                        <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                                        <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                        <telerik:RadDataPagerButtonField FieldType="NextLast" />
                                        <telerik:RadDataPagerPageSizeField PageSizeText="Page size: " />
                                        <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
                                            TextBoxWidth="15" />
                                        <telerik:RadDataPagerTemplatePageField>
                                            <PagerTemplate>
                                                <div style="float: right">
                                                    <b>Items
                                                        <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" />
                                                        to
                                                        <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
                                                        of
                                                        <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                                                        <br />
                                                    </b>
                                                </div>
                                            </PagerTemplate>
                                        </telerik:RadDataPagerTemplatePageField>
                                    </Fields>
                                </telerik:RadDataPager>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </LayoutTemplate>
            <ItemTemplate>
                <div style="float: left;">
                    <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100px">
                        <tr>
                            <td style="width: 75px">
                                String:
                            </td>
                            <td>
                                <%# Eval("Key") %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Quantity:
                            </td>
                            <td>
                                <%# Eval("Count") %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <telerik:RadListView ID="lvTest" runat="server" ItemPlaceholderID="holder" DataSource='<%# Eval("Strings") %>'>
                                    <LayoutTemplate>
                                        <asp:Panel ID="holder" runat="server" />
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <tr id="row" runat="server">
                                            <td>
                                            </td>
                                            <td>
                                                <%# Eval("Identifier")%>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </telerik:RadListView>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                        </tr>
                    </table>
                </div>
            </ItemTemplate>
        </telerik:RadListView>
    </asp:Panel>

Now, what I am trying to do is get a RadGrid in place of the nested RadListView because I need to allow programatic access to each element of each collection.

Essentially, a user within the UI will be setting the preferred item in the grid for each collection. So, a particular object in the collection might look like this:

Key: "Test"
Count: 15
List<object>

Within the object there is a string ("Identifier") that I am using amoung other properties.

"001"
"002"
"003"
"004" ...

Within the grid of each ListView item, the end user will select one of the grid items ("001", "002", etc...) and then that setting will be handled on the back end.

Although I get get the "displaying" of my data within nested RadListViews, I cannot for the life of me get the data into a grid, regardless of how I try to bind it in code behind (or in the page).

Anyone have any ideas?

Thanks,

Jim

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 30 Aug 2010, 08:12 AM
Hi James,

I would suggest that you bind the grid either by handling its NeedDataSource event or try setting the DataMember/DataSource property and see how it goes. Let me know of the result.

Kind regards,
Iana
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
Tags
Grid
Asked by
James Legan
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or