Hello,
I've got a nested grid that looks like this...
I have a button in the gridParentItems grid, and when I click it I want to get the ConferenceSubmissionItemSponsorshipID for the given item. I then use this code to allow a user to change the order of an item in the db...
The problem is that the itemsGrid.DataKeyValues has a count of 0. I know that the ConferenceSubmissionItemSponsorshipID is there - it'll show in the table if I add it as a column, so I can't figure out why it's not filling.
Does anybody have any ideas - I'm probably missing something obvious here, but it would really be helpful if I could figure this out because I use similar code in a few other places on the page and am having the same problems there...
Thanks,
Mike
I've got a nested grid that looks like this...
| <telerik:RadGrid ID="gridAllocations" runat="server" ShowHeader="false" |
| DataSourceID="dsComponentAllocationGroups"> |
| <MasterTableView AutoGenerateColumns="False" DataSourceID="dsComponentAllocationGroups" DataKeyNames="AllocationGroupID" HierarchyDefaultExpanded="True"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridTemplateColumn DataField="AllocationGroupDescription" |
| HeaderText="AllocationGroupDescription" |
| SortExpression="AllocationGroupDescription" |
| UniqueName="AllocationGroupDescription"> |
| <ItemTemplate> |
| <asp:label runat="server" ID="lblAllocationTitle" Text='<%# Eval("AllocationGroupDescription") & " - Your allocation is " & Decimal.Round(Eval("Allocation"),1) & " units."%>' Font-Bold="true"></asp:label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <DetailTables> |
| <telerik:GridTableView runat="server" Name="gridParentItems" AutoGenerateColumns="False" ShowHeader="true" |
| DataSourceID="dsFinalItems" GridLines="None" Skin="Default" |
| DataKeyNames="ConferenceSubmissionItemID,ConferenceSubmissionItemSponsorshipID"> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Visible="False" Resizable="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <ParentTableRelation> |
| <telerik:GridRelationFields MasterKeyField="AllocationGroupID" DetailKeyField="AllocationGroupID" /> |
| </ParentTableRelation> |
I have a button in the gridParentItems grid, and when I click it I want to get the ConferenceSubmissionItemSponsorshipID for the given item. I then use this code to allow a user to change the order of an item in the db...
| Protected Sub lnkMoveDown_Click(ByVal sender As Object, ByVal e As System.EventArgs) |
| Try |
| Dim curGridItem As GridItem = CType(CType(sender, LinkButton).Parent.Parent, GridItem) |
| Dim sponsorID As Integer |
| Dim itemsGrid As Telerik.Web.UI.GridTableView |
| itemsGrid = Me.gridAllocations.MasterTableView.DetailTables(0) |
| sponsorID = itemsGrid.DataKeyValues(curGridItem.ItemIndex)("ConferenceSubmissionItemSponsorshipID") |
| Dim curSponsor As New ISAConferenceSubmissionItemSponsor(sponsorID) |
| curSponsor.ChangeComponentOrder(CInt(Me.lblActiveComponent.Text), CInt(CType(sender, LinkButton).CommandArgument) + 1) |
| Me.gridAllocations.DataBind() |
| Catch |
| End Try |
| End Sub |
The problem is that the itemsGrid.DataKeyValues has a count of 0. I know that the ConferenceSubmissionItemSponsorshipID is there - it'll show in the table if I add it as a column, so I can't figure out why it's not filling.
Does anybody have any ideas - I'm probably missing something obvious here, but it would really be helpful if I could figure this out because I use similar code in a few other places on the page and am having the same problems there...
Thanks,
Mike