I have a radgrid on my page. It has a Details Table for children. For the parent rows that have no children I do now want any row(s) to show. I have used the below code and when I do, I still see a blank row underneath my parent row. What am I doing wrong?
The attached file is how my grid looks.
//If the details have no records, make it invisible
protected
void
rgCirculationDetails_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridNoRecordsItem && e.Item.OwnerTableView != rgCirculationDetails.MasterTableView)
e.Item.OwnerTableView.Visible =
false
;
}
//below code puts an empty string for a parent row that has no children
protected
void
rgCirculationDetails_DetailTableDataBind(
object
sender, GridDetailTableDataBindEventArgs e)
{
try
{
GridDataItem parentItem = e.DetailTableView.ParentItem
as
GridDataItem;
int
parentRow = Convert.ToInt32(parentItem.GetDataKeyValue(
"ParentRow"
));
string
geography = parentItem.GetDataKeyValue(
"Geography"
).ToString().Trim();
if
(e.DetailTableView.DataMember ==
"GeographyRows"
)
{
if
(parentRow == 1)
{
circulationServiceObj.CircDetail = circulationObj.GetCircDetailsForParentRow(circSetID, geography, dayID).CircDetail;
e.DetailTableView.DataSource = circulationServiceObj.CircDetail.CircDetail;
}
else
{
e.DetailTableView.DataSource = String.Empty;
}
}
}
catch
(SoapException ex)
{
}
}