RadGrid
r = new RadGrid();
r.MasterTableView.DataKeyNames =
new string[] { "DepartmentID" };
r.Skin =
"Default";
r.Width =
Unit.Percentage(100);
r.PageSize = 5;
r.AllowPaging =
true;
r.AutoGenerateColumns =
false;
r.MasterTableView.PageSize = 15;
//Add columns
GridBoundColumn boundColumn;
boundColumn =
new GridBoundColumn();
boundColumn.DataField =
"DepartmentID";
boundColumn.HeaderText =
"DepartmentID";
r.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new GridBoundColumn();
boundColumn.DataField =
"Budget";
boundColumn.HeaderText =
"Budget";
r.MasterTableView.Columns.Add(boundColumn);
//Detail table - Orders (II in hierarchy level)
GridTableView tableViewOrders = new GridTableView(r);
//tableViewOrders.DataSourceID = "AccessDataSource2";
tableViewOrders.DataKeyNames =
new string[] { "CourseID" };
GridRelationFields relationFields = new GridRelationFields();
relationFields.MasterKeyField =
"DepartmentID";
relationFields.DetailKeyField =
"DepartmentID";
tableViewOrders.ParentTableRelation.Add(relationFields);
RadGrid1.MasterTableView.DetailTables.Add(tableViewOrders);
//Add columns
boundColumn =
new GridBoundColumn();
boundColumn.DataField =
"CourseID";
boundColumn.HeaderText =
"CourseID";
tableViewOrders.Columns.Add(boundColumn);
boundColumn =
new GridBoundColumn();
boundColumn.DataField =
"Title";
boundColumn.HeaderText =
"Title";
tableViewOrders.Columns.Add(boundColumn);
r.AllowMultiRowSelection =
true;
r.MasterTableView.DetailTables.Add(tableViewOrders);
r.DetailTableDataBind +=
new GridDetailTableDataBindEventHandler(r_DetailTableDataBind);
r.NeedDataSource +=
new GridNeedDataSourceEventHandler(r_NeedDataSource);
r.ID =
"RockOn";
this.PlaceHolder1.Controls.Add(r);
its the same code posted on Site Examples..
it loads ok but when i try to expand the grid Row ... i get an error--
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
on page load i m binding the DataSets to the Grid