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

Paging in Detail table Rad Grid

2 Answers 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ash
Top achievements
Rank 1
Ash asked on 18 Aug 2008, 11:19 AM
Hello

This is in regard to paging not working in Hirarchial rad grid in the detail table. all i have is one master table and 2 nested tables inside it. I have done custom paging for Master table view and want to use default paging for the nested table. However when i try to move to page 2 in detail table, it is unable to bind as it looks for its source in need data source event where i only have binded it to master table and have set datasource for details table in the DetailTableDataBind event.

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

{

if (!e.IsFromDetailTable)

{

RadGrid1.DataSource = GetGridData();

}

}

protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)

{

GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

switch (e.DetailTableView.Name)

{

case "Element":

{

string CustomerID = dataItem.GetDataKeyValue("CustomerID").ToString(); 

e.DetailTableView.DataSource = GetDataTable(

"Element", CustomerID);

break;

}

case "Criteria":

{

string OrderID = dataItem.GetDataKeyValue("OrderID").ToString();

e.DetailTableView.DataSource = GetDataTable(

"Criteria", OrderID);

break;

}

}

}

public DataTable GetDataTable(string Type, String Id)

{

DataSet myDataSet;

DataTable myResultsView = new DataTable();

if (Type == "Element")

{

myDataSet = aw.sn.

GetElementListByUnit.ExecuteDataSet (dbConnString,Convert.ToInt32(Id));

myResultsView = myDataSet.Tables[0];

}

if (Type == "Criteria")

{

myDataSet = aw.sn.

GetCriteriaListByElement.ExecuteDataSet(dbConnString, Convert.ToInt32(Id), isignpostId);

myResultsView = myDataSet.Tables[0];

}

return myResultsView;

}

Please help..

Many Thanks
Ash

2 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 21 Aug 2008, 08:42 AM
Hi Ash,

Please review the following online example, which represents the paging in DetailTable. Review the provided sample and verify what the difference in your case is.


Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ash
Top achievements
Rank 1
answered on 24 Aug 2008, 10:26 PM
hi Maria

Thanks a lot for the online example.I read it and compared with my code and found that  everything was fine and there was a programmnig  problem in the item command event because of which the page 2 in detail table was not showing up. And now my grid is working perfectly the way it should. Thanks for such a good example.

Cheers Telerik Team...

Best Regards
Ash
Tags
Grid
Asked by
Ash
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Ash
Top achievements
Rank 1
Share this question
or