private void DefineGridStructure()
{
/* Hierarchy Grid - lab and test types for each lab */
RadGrid oRadGridLab = new RadGrid();
oRadGridLab.ID = "TelRadGridLab";
var oLaboratories
= (from p in this.Core.EntityModel.Laboratories
select p).ToList();
oRadGridLab.DataSource = oLaboratories;
oRadGridLab.DataMember = "Laboratory";
oRadGridLab.MasterTableView.DataKeyNames = new string[] { "Idn" };
oRadGridLab.Skin = "Office2007";
oRadGridLab.Width = Unit.Percentage(98);
oRadGridLab.PageSize = 3;
oRadGridLab.AllowPaging = true;
oRadGridLab.AllowSorting = true;
oRadGridLab.PagerStyle.Mode = GridPagerMode.NumericPages;
oRadGridLab.AutoGenerateColumns = false;
//oRadGridLab.MasterTableView.GroupLoadMode = GridGroupLoadMode.Client;
oRadGridLab.MasterTableView.PageSize = 3;
//Add columns
GridBoundColumn boundColumn;
boundColumn = new GridBoundColumn();
boundColumn.DataField = "Idn";
boundColumn.HeaderText = "Idn";
oRadGridLab.MasterTableView.Columns.Add(boundColumn);
boundColumn = new GridBoundColumn();
boundColumn.DataField = "Name";
boundColumn.HeaderText = "Name";
oRadGridLab.MasterTableView.Columns.Add(boundColumn);
oRadGridLab.DataBind();
//Detail table - Test Types (II in hierarchy level)
GridTableView oTableViewTestTypes = new GridTableView(oRadGridLab);
var oTestTypes
= (from p in this.Core.EntityModel.TestTypeToLaboratories
select p).ToList();
oTableViewTestTypes.DataSource = oTestTypes;
oTableViewTestTypes.DataMember = "TestTypeToLaboratory";
oTableViewTestTypes.Width = Unit.Percentage(100);
oTableViewTestTypes.DataKeyNames = new string[] { "Idn" };
GridRelationFields relationFields = new GridRelationFields();
relationFields.MasterKeyField = "Idn";
relationFields.DetailKeyField = "LaboratoryIdn";
oTableViewTestTypes.ParentTableRelation.Add(relationFields);
oRadGridLab.MasterTableView.DetailTables.Add(oTableViewTestTypes);
//Add columns
boundColumn = new GridBoundColumn();
boundColumn.DataField = "LaboratoryIdn";
boundColumn.HeaderText = "LaboratoryIdn";
oTableViewTestTypes.Columns.Add(boundColumn);
boundColumn = new GridBoundColumn();
boundColumn.DataField = "CreatedOn";
boundColumn.HeaderText = "CreatedOn";
oTableViewTestTypes.Columns.Add(boundColumn);
boundColumn = new GridBoundColumn();
boundColumn.DataField = "ModifiedOn";
boundColumn.HeaderText = "ModifiedOn";
oTableViewTestTypes.Columns.Add(boundColumn);
oTableViewTestTypes.DataBind();
//Add the RadGrid instance to the controls
this.AspPlaceHolder.Controls.Add(oRadGridLab);
}
<ucs:ListsTab ID="ucListsControl" runat="server" />public TplListControlTab TplListControl { get { return ucListsControl; } }<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel2" /> <telerik:AjaxUpdatedControl ControlID="ucListsControl" /> </UpdatedControls></telerik:AjaxSetting>var _ajaxManager = "<%= RadAjaxManager1.ClientID %>";$find(_ajaxManager).ajaxRequest("SomeCommand");if (e.Argument == "SomeCommand") { // ... do some stuff to RadGrid's datasource. RadGrid1.Rebind(); // ... do some stuff to user control's datasource. Master.TplListControl.RadTreeView.DataBind();
}