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

[Solved] master detail select parameter passed is null

1 Answer 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 14 Aug 2009, 05:35 PM
I'm starting out with the radgrid and I'm having trouble setting up a master/detail relationship with the radgrid. I have the basic setup working, but when i select a master record in the grid, the child record says "no child rows found". I'm not sure how the grid determines how to pass the "GoalId" select parameter to the detailsview. I notice some samples use a base select parameter field and others use a session parameter field. How is this setup and determined? I have the following code. The e.selectparameters is always showing up as null in the code when i break into it.

Any advice?

onselecting event for datasource:

 

protected void ActivitiesData_Selecting(object sender, LinqDataSourceSelectEventArgs e)

 

{

 

DevelopmentPlanRepository dvp = new DevelopmentPlanRepository(Conn);

 

e.Result = dvp.GetActivitiesForGoal(

Convert.ToInt32(e.SelectParameters["GoalId"]));

 

}




<

 

telerik:RadGrid ID="DevelopmentGoalGrid" runat="server" AllowPaging="True"

 

 

AllowSorting="True" DataSourceID="GoalsData" GridLines="None">

 

<

 

MasterTableView DataKeyNames="GoalId" DataSourceID="GoalsData">

 

 

<DetailTables>

 

 

<telerik:GridTableView DataKeyNames="ActivityID" DataSourceID="ActivitiesData" Width="100%"

 

 

runat="server" AutoGenerateColumns="true">

 

 

<ParentTableRelation>

 

 

<telerik:GridRelationFields DetailKeyField="GoalId" MasterKeyField="GoalId" />

 

 

</ParentTableRelation>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</ExpandCollapseColumn>

 

 

</telerik:GridTableView>

 

 

</DetailTables>

 

<

 

RowIndicatorColumn>

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

RowIndicatorColumn>

 

<

 

ExpandCollapseColumn Visible="True">

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

ExpandCollapseColumn>

 

</

 

MasterTableView>

 

 

<ClientSettings>

 

 

<Selecting AllowRowSelect="True" />

 

 

</ClientSettings>

 

</

 

telerik:RadGrid>

 

<

 

p>

 

 

&nbsp;</p>

 

<

 

p>

 

 

&nbsp;</p>

 

<

 

asp:LinqDataSource ID="GoalsData" runat="server"

 

 

onselecting="GoalsData_Selecting">

 

</

 

asp:LinqDataSource>

 

<

 

asp:LinqDataSource ID="ActivitiesData" runat="server"

 

 

onselecting="ActivitiesData_Selecting">

 

 

<SelectParameters>

 

 

<asp:Parameter Name="GoalId" Type="Int32" />

 

 

</SelectParameters>

 

 

</

 

asp:LinqDataSource>

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Aug 2009, 09:43 AM
Hi Jason,

In the above given code I can see that you are using the Select parameter. Try using the Where parameter as shown in the following demo.
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/linqdatasource/defaultcs.aspx

Thanks
Shinu
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or