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

Details Table issue

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 02 Nov 2011, 06:09 PM
Hello,

I have finally managed to get the radgrid to work with all its features (insert, edit, delete, details view). However, the details table is showing me the same table that the original grid is showing. (Screenshot)

I have 2 table:

news:
- N_id
- title
- article
- time
- U_id

users
- U_id
- member

I have already populated the data manually. What I want to do when I click on the expand button to see the details table, is to see the user who wrote that article. And I have to SqlDatasources, I just have to edit one to show the user WHERE news.userid = users.id, but how?

EDIT: I figured out the query and I'm not getting any error when I load the page. But when I click on the expand button, I get something weird (Screenshot). 

I just want to show the Name (member) of the person who wrote that article. Just 1 row.

SELECT users.member, news.U_id
FROM users
INNER JOIN news
ON users.U_id=news.U_id

2 Answers, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 02 Nov 2011, 09:54 PM
oh George
can you get SQLDataSources to work?
<asp:SqlDataSource ID="sdsVendors"
    ConnectionString="<%$ ConnectionStrings:korders_BrunswickConnectionString %>"
    SelectCommand="get_vendors_for_spiff_maintanance" SelectCommandType="StoredProcedure" runat="server" >
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsSpiffs"
    ConnectionString="<%$ ConnectionStrings:korders_BrunswickConnectionString %>"
    SelectCommand="get_spiff_details" SelectCommandType="StoredProcedure" runat="server" >
    <SelectParameters>
        <asp:Parameter Name="VendorID" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>
this application has something called a spiff, which is per vendor
expanding the spiff "knows" what vendor to use by a ParentTableRelation:
        <telerik:RadGrid ID="rgSpiffDetail" DataSourceID="sdsVendors" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" AllowFilteringByColumn="true"
        AllowAutomaticInserts="False" AllowAutomaticDeletes="False" AllowAutomaticUpdates="False" Width="95%" runat="server" >
        <GroupingSettings CaseSensitive="false" />       
        <MasterTableView Name="Vendors" DataSourceID="sdsVendors" DataKeyNames="VendorID" CommandItemDisplay="None" Width="100%">
            <DetailTables>
                <telerik:GridTableView Name="Spiffs" DataKeyNames="SpiffID" DataSourceID="sdsSpiffs" CommandItemDisplay="Top" AllowFilteringByColumn="False" Width="100%" runat="server" >
                <CommandItemSettings AddNewRecordText="New Spiff" />
                <ParentTableRelation>
                    <telerik:GridRelationFields MasterKeyField="VendorID" DetailKeyField="VendorID" />
                </ParentTableRelation>
and so forth

hope this helps
0
Shinu
Top achievements
Rank 2
answered on 03 Nov 2011, 12:24 PM
Hello George,

Make sure that you have specified the ParentTableRelation as explained in this demo.
Grid / Declarative Relations

Thanks,
Shinu.
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or