Hi,
I have a scenario where I need to loop through the number of rows in the detail table for each row and read the columns in the detail table.
I am binding my grid to a datasource with the relation defined.
I am unable to read the child rows in my ItemDataBound event. I tried using dataItem.childItem but my child Item always comes null.
I am not sure my detail table is getting any data or not.
I don't want to show my detail table to the user just want to read the values in the detail table.
Below is how my detail table is defined:
Basically I have a asp.net gridview to migrate from and currently I am using this to access the child rows:
protected void balances_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView drv = (DataRowView)e.Row.DataItem;
DataRow[] drSubBalance = drv.Row.GetChildRows("BalanceRelation");
}
}
I want to do something similar in radgrid.
I have spent 2 days trying to figure this out. Please provide some help!
I have a scenario where I need to loop through the number of rows in the detail table for each row and read the columns in the detail table.
I am binding my grid to a datasource with the relation defined.
I am unable to read the child rows in my ItemDataBound event. I tried using dataItem.childItem but my child Item always comes null.
I am not sure my detail table is getting any data or not.
I don't want to show my detail table to the user just want to read the values in the detail table.
Below is how my detail table is defined:
<
MasterTableView
TableLayout
=
"Fixed"
HierarchyDefaultExpanded
=
"true"
CommandItemDisplay
=
"Top"
EnableNoRecordsTemplate
=
"true"
>
<
Columns
>
......
</
Columns
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"AccountID"
Width
=
"100%"
DataMember
=
"FundBalance"
HierarchyLoadMode
=
"ServerBind"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"AccountID"
MasterKeyField
=
"AccountID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"AccountID"
UniqueName
=
"AccountID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FundTypeID"
UniqueName
=
"FundTypeID"
>
</
telerik:GridBoundColumn
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginBalanceShares"
DataField
=
"BeginBalanceShares"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginPrice"
DataField
=
"BeginPrice"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginBalanceDollars"
DataField
=
"BeginBalanceDollars"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"EndBalanceShares"
DataField
=
"EndBalanceShares"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
</
MasterTableView
>
My datasource is defined as:
public static DataTable ListByPlanAndDateRange(int planID, DateTime beginDate, DateTime endDate)
{
DataSet ds = DBRoutines.wusp_PeriodSummaryByFund_ListByPlanAndDateRange(planID, beginDate, endDate);
ds.Tables[0].TableName = "FundBalance";
ds.Tables[1].TableName = "SourceContribution";
ds.Relations.Add("BalanceRelation", ds.Tables[0].Columns[Fields.FundID], ds.Tables[1].Columns[Fields.FundID], false);
return ds.Tables[0];
}
Basically I have a asp.net gridview to migrate from and currently I am using this to access the child rows:
protected void balances_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView drv = (DataRowView)e.Row.DataItem;
DataRow[] drSubBalance = drv.Row.GetChildRows("BalanceRelation");
}
}
I want to do something similar in radgrid.
I have spent 2 days trying to figure this out. Please provide some help!