Imports LinqToSQL
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
GridLines
=
"None"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnUpdateCommand
=
"RadGrid1_UpdateCommand1"
OnItemCreated
=
"RadGrid1_ItemCreated"
>
<
MasterTableView
DataSourceID
=
"SqlDataSource1"
Name
=
"Client"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"account_id,contact_id1,user_id"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"user_id"
runat
=
"server"
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add New Accommodation"
Caption
=
"Accommodation"
DataSourceID
=
"SqlDataSource4"
Width
=
"100%"
AutoGenerateColumns
=
"false"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
Name
=
"Accommodation"
>
<
NestedViewTemplate
>
<
asp:Panel
runat
=
"server"
ID
=
"InnerContainer"
Visible
=
"false"
>
<
telerik:RadTabStrip
runat
=
"server"
ID
=
"AccommodationTabStrip"
MultiPageID
=
"MultiPage1"
SelectedIndex
=
"1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Alternative Contacts"
PageViewID
=
"PageView1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Features/Facilities"
PageViewID
=
"PageView2"
Selected
=
"True"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Gallery"
PageViewID
=
"PageView3"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
PageViewID
=
"PageView5"
Text
=
"Bookings"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Statistics"
PageViewID
=
"PageView4"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
runat
=
"server"
ID
=
"MultiPage1"
SelectedIndex
=
"0"
RenderSelectedPageOnly
=
"false"
Width
=
"656px"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"PageView1"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text='<%# Eval("user_id") %>'></
asp:Label
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"AccommContactsGrid"
DataSourceID
=
"SqlDataSource6"
ShowFooter
=
"True"
AllowSorting
=
"True"
EnableLinqExpressions
=
"False"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
GridLines
=
"None"
>
<
MasterTableView
ShowHeader
=
"true"
DataKeyNames
=
"accom_id"
PageSize
=
"7"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
CommandItemTemplate
>
<
div
style
=
"padding: 5px 5px;"
>
<
asp:LinkButton
ID
=
"btnInsertAccom"
CommandName
=
"InitInsert"
OnClientClick
=
"return ShowInsertForm();"
runat
=
"server"
><
img
style
=
"border: 0px; vertical-align:middle;"
src
=
"Images/03.png"
/>Add New Client Account</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"btnOptionsAccom"
CommandName
=
"Options"
runat
=
"server"
OnClientClick
=
"return ShowOptionsForm();"
><
img
style
=
"border: 0px; vertical-align:middle;"
src
=
"Images/09.png"
/>Options</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"btnRefreshAccom"
CommandName
=
"RebindGrid"
runat
=
"server"
><
img
style
=
"border: 0px; vertical-align:middle;"
src
=
"Images/21.png"
/>Refresh Link Group List</
asp:LinkButton
>
</
div
>
</
CommandItemTemplate
>
<
Columns
>
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridNestedViewItem)
{
Panel panel = (Panel)e.Item.FindControl(
"InnerContainer"
);
if
(panel !=
null
)
{
panel.Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
}
}
}
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();
}