Private
Sub
DisplayMessage(text
As
String
)
grdList.Controls.AddAt(0,
New
LiteralControl(
String
.Format(
"<span style='color:red'>{0}</span>"
, text)))
End
Sub
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None" AutoGenerateColumns="False"> <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="JOB_ID" HierarchyLoadMode="ServerBind" AutoGenerateColumns="false"> <DetailTables> <telerik:GridTableView DataSourceID="SqlDataSource2" Width="100%" runat="server" HierarchyLoadMode="ServerBind" AutoGenerateColumns="false"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="JOB_ID" MasterKeyField="JOB_ID" /> </ParentTableRelation> <Columns> <telerik:GridBoundColumn SortExpression="SET_TIME" HeaderText="SET_TIME" HeaderButtonType="TextButton" DataField="SET_TIME" UniqueName="SET_TIME" /> <telerik:GridBoundColumn SortExpression="NODE_NAME" HeaderText="NODE_NAME" HeaderButtonType="TextButton" DataField="NODE_NAME" UniqueName="NODE_NAME" /> </Columns> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn SortExpression="JOB_ID" HeaderText="JOB_ID" HeaderButtonType="TextButton" DataField="JOB_ID" UniqueName="JOB_ID" /> <telerik:GridBoundColumn SortExpression="PROCESS_NAME" HeaderText="PROCESS_NAME" HeaderButtonType="TextButton" DataField="PROCESS_NAME" UniqueName="PROCESS_NAME" /> </Columns> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT [JOB_ID], [PROCESS_NAME] FROM [JOB]"> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT [SET_TIME], [NODE_NAME] FROM [JOB_HISTORY] WHERE ([JOB_ID] = @JOB_ID)"> <SelectParameters> <asp:SessionParameter Name="JOB_ID" SessionField="JOB_ID" Type="Object" /> </SelectParameters> </asp:SqlDataSource>
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div align="center" style="width: 100%">
<
br />
<
table style="width: 100%">
<tr>
<td align="right" style="width: 25%">
<asp:Label ID="Label1" runat="server" Text="Customer:" SkinID="mediumlbl"></asp:Label> </td>
<td align="left" style="width: 25%">
<asp:DropDownList ID="dropCustomer" runat="server" SkinID="RegDrop"
AutoPostBack="True">
</asp:DropDownList>
</td>
<td align="right" style="width: 25%">
<asp:Label ID="Label4" runat="server" Text="Active:" SkinID="mediumlbl"></asp:Label> </td>
<td align="left" style="width: 25%">
<asp:DropDownList ID="dropActive" runat="server" SkinID="RegDrop"
AutoPostBack="True">
<asp:ListItem Selected="True" Value="1">Active</asp:ListItem>
<asp:ListItem Value="0">Deleted</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<
hr />
<asp:Label ID="lblError" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
<br />
<table style="width: 80%" align="center">
<tr>
<td align="left">
<asp:Button ID="btnExcel" runat="server" Text="Export to Excel" />
</td>
<td align="center">
<asp:Button ID="btnWord" runat="server" Text="Export to Word" />
</td>
<td align="right">
<asp:Button ID="btnCSV" runat="server" Text="Export to CSV" />
</td>
</tr>
</
table>
<
br />
<telerik:RadGrid ID="RadCustomerParts" runat="server" AllowSorting="True"
GridLines="None" Skin="WebBlue"
DataSourceID="dsCustomerParts" OnItemCommand="RadCustomerParts_ItemCommand"
AutoGenerateColumns="False" AllowPaging="True" PageSize="20"
AllowFilteringByColumn="True" >
<GroupingSettings CaseSensitive="false" />
<
HeaderContextMenu>
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
HeaderContextMenu>
<
GroupingSettings CaseSensitive="False"></GroupingSettings>
<ExportSettings ExportOnlyData="True" FileName="Customer Parts"
IgnorePaging="True" OpenInNewWindow="True">
</ExportSettings>
<
MasterTableView EditMode="PopUp" CommandItemDisplay="Top" DataKeyNames="CustomerPartNumberID" DataSourceID="dsCustomerParts" >
<CommandItemTemplate>
<table>
<tr>
<td width="10%">
<asp:LinkButton ID="btnAddNewItem" Text="Add new item"
Runat="server" CommandName="InitInsert"></asp:LinkButton>
</td>
<td width="80%">
</td>
<td width="10%">
<asp:LinkButton ID="btnRefresh" Text="Refresh data" CommandName="Rebind" Runat="server"></asp:LinkButton>
</td>
</tr>
</table>
</CommandItemTemplate>
 
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
style="border-collapse: collapse;background:white;">
<tr >
<td colspan="2" style="font-size: small">
<b>Customer Part Details</b></td>
</tr>
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="98%" border="0" >
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Customer ID:
</td>
<td>
<asp:DropDownList ID="DropCustEdit" runat="server" SelectedValue='<%# Bind("CustomerID") %>'
DataSourceID="dsCustomerDrop" DataTextField="Name"
DataValueField="CustomerID" TabIndex="1" AppendDataBoundItems="True" >
<asp:ListItem Selected="True" Text="Select Customer" Value="0"></asp:ListItem>
</asp:DropDownList>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
ControlToValidate="DropCustEdit" ErrorMessage="This field is required" runat="server" InitialValue="0"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Part Number:
</td>
<td>
<asp:TextBox ID="txtpartnumber" runat="server" Text='<%# Bind( "PartNumber") %>' TabIndex="2">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
ControlToValidate="txtpartnumber" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Part Description:
</td>
<td>
<asp:TextBox ID="txtDesc" runat="server" Text='<%# Bind( "Description") %>' TabIndex="3">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
UOM:
</td>
<td>
<asp:DropDownList ID="dropUOM" runat="server" SelectedValue='<%# Bind("UnitOfMeasureCD") %>'
DataSourceID="dsUOM" DataTextField="Description" DataValueField="UnitofMeasureCD" TabIndex="4" AppendDataBoundItems="True">
<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Category:
</td>
<td>
<asp:DropDownList ID="DropCategory" runat="server"
DataSourceID="dsCustomerCategory" DataTextField="Category" TabIndex="5"
DataValueField="Category" >
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Length:
</td>
<td>
<asp:TextBox ID="txtLength" runat="server" TabIndex="6"
Text='<%# Bind( "Length") %>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Height:
</td>
<td>
<asp:TextBox ID="txtHeight" runat="server" Text='<%# Bind( "Height") %>' TabIndex="7">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Width:
</td>
<td>
<asp:TextBox ID="txtWidth" runat="server" Text='<%# Bind( "Width") %>' TabIndex="8">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Weight:
</td>
<td>
<asp:TextBox ID="txtWeight" runat="server" Text='<%# Bind( "Weight") %>' TabIndex="9">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Manufacturer:
</td>
<td>
<asp:TextBox ID="txtManu" runat="server" Text='<%# Bind( "Manufact") %>' TabIndex="10">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Alt Ref #:
</td>
<td>
<asp:TextBox ID="txtAltRef" runat="server" Text='<%# Bind( "AltRefOne") %>' TabIndex="11">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Serialized:
</td>
<td>
<asp:CheckBox ID="chkSerial" Checked='<%# Bind("Serialized") %>' runat="server" TabIndex="12" />
</td>
</tr>
<tr>
<td>
Parts Quantity Per Unit:
</td>
<td>
<asp:TextBox ID="txtPQPU" runat="server" Text='<%# Bind( "PartQuantityPerUnit") %>' TabIndex="13">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
ControlToValidate="txtPQPU" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Quantity Alert Minimum:
</td>
<td>
<asp:TextBox ID="txtMin" runat="server" Text='<%# Bind( "QuantityAlertMinimum") %>' TabIndex="14">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="txtMin" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Quantity Alert Maximum:
</td>
<td>
<asp:TextBox ID="txtMax" runat="server" Text='<%# Bind( "QuantityAlertMaximum") %>' TabIndex="15">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="txtMax" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Special Instructions:
</td>
<td>
<asp:TextBox ID="txtSpecial" runat="server" Text='<%# Bind( "SpecialInstructions") %>' TabIndex="16" TextMode="MultiLine" Width="250px">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Active:
</td>
<td>
<asp:CheckBox ID="chkActive" Checked='<%# Bind("Active") %>' runat="server" TabIndex="17" />
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdatep2" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
runat="server"
CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'
TabIndex="17" >
</asp:Button>
</td>
<td>
<asp:Button ID="btnCancel" CommandName="Cancel" runat="server" Text="Cancel" CausesValidation="false" TabIndex="18" />
</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
<%
--<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>--%>
<%
--<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>--%>
<
RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<
ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridButtonColumn ButtonType="PushButton"
CommandName="Edit" Text="Edit" UniqueName="EditPart">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn ButtonType="PushButton" ConfirmText="Delete this part?"
CommandArgument="CustomerPartNumberID" CommandName="Delete" Text="Delete"
UniqueName="DeletePart">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn ReadOnly="True" DataField="CustomerPartNumberID"
UniqueName="CustomerPartNumberID" DataType="System.Int32"
HeaderText="CustomerPartNumberID" SortExpression="CustomerPartNumberID" Visible="false" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID" Visible="true" HeaderText="Customer ID" DataType="System.Int32" SortExpression="CustomerID" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerName" UniqueName="CustomerName" Visible="true" HeaderText="Customer" Readonly="true" SortExpression="CustomerName" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PartNumber" UniqueName="PartNumber"
Visible="True" HeaderText="Part Number"
SortExpression="PartNumber" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description"
SortExpression="Description" UniqueName="Description" AllowFiltering="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AltRefOne" HeaderText="Alt Ref #"
SortExpression="AltRefOne" UniqueName="AltRefOne" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Serialized" UniqueName="Serialized"
Visible="True" HeaderText="Serialized" DataType="System.Byte"
SortExpression="Serialized" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Category" HeaderText="Cat" SortExpression="Category"
UniqueName="Category" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UOM" HeaderText="UOM" SortExpression="UOM"
UniqueName="UOM" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Height" HeaderText="Height"
SortExpression="Height" UniqueName="Height" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Length" HeaderText="Length"
SortExpression="Length" UniqueName="Length" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Width" HeaderText="Width"
SortExpression="Width" UniqueName="Width" AllowFiltering="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Weight" HeaderText="Weight"
SortExpression="Weight" UniqueName="Weight" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UnitOfMeasureCD" HeaderText="UnitOfMeasureCD" SortExpression="UnitOfMeasureCD"
UniqueName="UOMCD" Visible="false" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PartQuantityPerUnit" UniqueName="PartQuantityPerUnit"
Visible="False" HeaderText="Part Quantity Per Unit" DataType="System.Int32"
SortExpression="PartQuantityPerUnit" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QuantityAlertMinimum" UniqueName="QuantityAlertMinimum"
Visible="False" HeaderText="Quantity Alert Minimum" DataType="System.Int32"
SortExpression="QuantityAlertMinimum" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QuantityAlertMaximum"
DataType="System.Int32" HeaderText="Quantity Alert Maximum"
SortExpression="QuantityAlertMaximum" UniqueName="QuantityAlertMaximum"
Visible="False" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SpecialInstructions"
HeaderText="Special Instructions" SortExpression="SpecialInstructions"
UniqueName="SpecialInstructions" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manufact" HeaderText="Manufacturer"
SortExpression="Manufact" UniqueName="Manufacturer" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn DataField="Active" DataType="System.Byte"
HeaderText="Active" SortExpression="Active" UniqueName="TempActive" AllowFiltering="false">
<ItemTemplate>
<asp:CheckBox ID="chkActive" runat="server" Checked='<%# eval("Active") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
 
</
MasterTableView>
<
FilterMenu>
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
FilterMenu>
</telerik:RadGrid>
 
 
<asp:SqlDataSource ID="dsCustomerParts" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMSCustomerPartNumbersByCustomerIDByBusinessType"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="dropCustomer" Name="CustomerID"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="dropActive" DefaultValue="1" Name="Active"
PropertyName="SelectedValue" Type="Byte" />
<asp:SessionParameter DefaultValue="6" Name="BusinessTypeID"
SessionField="BusinessTypeID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsCustomerDrop" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMSCustomerDropByBusinessType"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter DefaultValue="6" Name="BusinessTypeID"
SessionField="BusinessTypeID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsCustomerCategory" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMCustomerCategoryDrop" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="dropCustomer" Name="CustomerID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsUOM" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_UnitofMeasureDrop" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
 
VB Code -
Protected Sub RadCustomerParts_selectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadCustomerParts.SelectedIndexChanged
If TypeOf e.Item Is GridDataItem Then
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim ddList As DropDownList = CType(editedItem("dropcategory").Controls(0), DropDownList)
ddList.DataSource = dsCustomerCategory
ddList.DataBind()
 
End If
<%@
Assembly
Name=
"$SharePoint.Project.AssemblyFullName$"
%>
<%@
Assembly
Name=
"Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Register TagPrefix=
"SharePoint"
Namespace
=
"Microsoft.SharePoint.WebControls"
Assembly
=
"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Register TagPrefix=
"Utilities"
Namespace
=
"Microsoft.SharePoint.Utilities"
Assembly
=
"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Register TagPrefix=
"asp"
Namespace
=
"System.Web.UI"
Assembly
=
"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
%>
<%@ Import
Namespace
=
"Microsoft.SharePoint"
%>
<%@ Register TagPrefix=
"WebPartPages"
Namespace
=
"Microsoft.SharePoint.WebPartPages"
Assembly
=
"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Control Language=
"VB"
AutoEventWireup=
"true"
CodeBehind=
"ERM_RiskReportingUserControl.ascx.vb"
Inherits
=
"ERMWeb.ERM_RiskReportingUserControl"
%>
<%@ Register
Assembly
=
"Telerik.Web.UI, Version=2011.1.614.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace
=
"Telerik.Web.UI"
TagPrefix=
"telerik"
%>
<telerik:RadGrid ID=
"RadGrid1"
runat=
"server"
AutoGenerateColumns=
"False"
GridLines=
"Horizontal"
AllowAutomaticDeletes=
"True"
AllowAutomaticInserts=
"True"
AllowAutomaticUpdates=
"True"
CellSpacing=
"0"
>
<MasterTableView DataKeyNames=
"ID"
CommandItemDisplay=
"Top"
EditMode=
"InPlace"
EnableColumnsViewState=
"false"
>
<Columns>
<telerik:GridBoundColumn DataField=
"ID"
HeaderText=
"ID"
UniqueName=
"ID"
ReadOnly
=
"true"
ItemStyle-Width=
"20px"
/>
<telerik:GridEditCommandColumn UniqueName=
"EditCommandColumn"
ButtonType=
"ImageButton"
ItemStyle-Width=
"50px"
/>
<telerik:GridBoundColumn DataField=
"Strategy"
HeaderText=
"Strategy"
UniqueName=
"Strategy"
ItemStyle-Width=
"400px"
/>
<telerik:GridBoundColumn DataField=
"RiskFactor"
HeaderText=
"Risk Factor"
UniqueName=
"RiskFactor"
ItemStyle-Width=
"400px"
/>
<telerik:GridBoundColumn DataField=
"RiskOwner"
HeaderText=
"Risk Owner"
UniqueName=
"RiskOwner"
ItemStyle-Width=
"300px"
/>
<telerik:GridDropDownColumn DataField=
"Impact"
HeaderText=
"Impact"
UniqueName=
"Impact"
ItemStyle-Width=
"80px"
/>
<telerik:GridDropDownColumn DataField=
"Likelihood"
HeaderText=
"Likelihood"
UniqueName=
"Likelihood"
ItemStyle-Width=
"80px"
/>
</Columns>
<NestedViewSettings>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField=
"ID"
MasterKeyField=
"ID"
/>
</ParentTableRelation>
</NestedViewSettings>
<NestedViewTemplate>
<table cellpadding=
"30px"
>
<tr>
<td>
<telerik:RadGrid ID=
"RadGrid2"
runat=
"server"
Skin=
"WebBlue"
OnItemDataBound=
"RadGrid2_ItemDataBound"
OnNeedDataSource=
"RadGrid2_NeedDataSource"
AutoGenerateColumns=
"false"
AllowAutomaticInserts=
"True"
AllowAutomaticUpdates=
"True"
>
<ClientSettings EnableRowHoverStyle=
"False"
>
<Selecting AllowRowSelect=
"True"
/>
</ClientSettings>
<MasterTableView DataKeyNames=
"RiskItemID"
CommandItemDisplay=
"Top"
EditMode=
"InPlace"
>
<Columns>
<telerik:GridBoundColumn DataField=
"ID"
HeaderText=
"ID"
UniqueName=
"ID"
ReadOnly
=
"true"
ItemStyle-Width=
"20px"
/>
<telerik:GridEditCommandColumn UniqueName=
"EditCommandColumn"
ButtonType=
"ImageButton"
ItemStyle-Width=
"50px"
/>
<telerik:GridBoundColumn DataField=
"RiskConsequence"
HeaderText=
"Risk Consequence"
UniqueName=
"RiskConsequence"
ItemStyle-Width=
"250px"
/>
<telerik:GridBoundColumn DataField=
"RiskCause"
HeaderText=
"Risk Cause"
UniqueName=
"RiskCause"
ItemStyle-Width=
"250px"
/>
<telerik:GridBoundColumn DataField=
"CurrentMitigation"
HeaderText=
"Current Mitigation"
UniqueName=
"CurrentMitigation"
ItemStyle-Width=
"300px"
/>
<telerik:GridBoundColumn DataField=
"ProposedMitigation"
HeaderText=
"Proposed Mitigation"
UniqueName=
"ProposedMitigation"
ItemStyle-Width=
"300px"
/>
<telerik:GridBoundColumn DataField=
"ImplementationPlan"
HeaderText=
"Implementation Plan"
UniqueName=
"ImplementationPlan"
ItemStyle-Width=
"150px"
/>
<telerik:GridDropDownColumn DataField=
"RiskItemID"
HeaderText=
""
UniqueName=
"RiskItemID"
Visible=
"false"
ItemStyle-Width=
"0px"
/>
</Columns>
<EditFormSettings>
<EditColumn ButtonType=
"ImageButton"
/>
</EditFormSettings>
<EditItemStyle VerticalAlign=
"Top"
/>
</MasterTableView>
</telerik:RadGrid>
</td>
</tr>
</table>
</NestedViewTemplate>
<EditFormSettings>
<EditColumn ButtonType=
"ImageButton"
/>
</EditFormSettings>
<EditItemStyle VerticalAlign=
"Top"
/>
</MasterTableView>
</telerik:RadGrid>
Imports
System
Imports
System.Web.UI
Imports
System.Web.UI.WebControls
Imports
System.Web.UI.WebControls.WebParts
Imports
Telerik.Web.UI
Partial
Public
Class
RiskReportingUserControl
Inherits
UserControl
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
Me
.Load
Me
.EnableViewState =
True
If
Not
Me
.IsPostBack
Then
'BindToGrid()
DisplayMessage(
"No text"
)
End
If
End
Sub
Protected
Function
GetParentGridTable()
As
DataTable
Dim
oSiteCollection
As
SPSite = SPContext.Current.Site
Dim
oWebsiteRoot
As
SPWeb = oSiteCollection.OpenWeb()
Dim
myList
As
Microsoft.SharePoint.SPList
myList = oWebsiteRoot.Lists(
"RiskItem"
)
Dim
results
As
SPListItemCollection = myList.Items
Dim
tbl
As
New
DataTable()
tbl.Columns.Add(
"ID"
,
GetType
(
String
))
tbl.Columns.Add(
"Strategy"
,
GetType
(
String
))
tbl.Columns.Add(
"RiskFactor"
,
GetType
(
String
))
tbl.Columns.Add(
"RiskOwner"
,
GetType
(
String
))
tbl.Columns.Add(
"Impact"
,
GetType
(
String
))
tbl.Columns.Add(
"Likelihood"
,
GetType
(
String
))
Dim
row
As
DataRow
For
Each
result
As
SPListItem
In
results
row = tbl.Rows.Add()
row(
"ID"
) = result(
"ID"
).ToString()
row(
"Strategy"
) = result(
"Strategy"
).ToString()
row(
"RiskFactor"
) = result(
"RiskFactor"
).ToString()
row(
"RiskOwner"
) = result(
"RiskOwner"
).ToString()
row(
"Impact"
) = result(
"Impact"
).ToString()
row(
"Likelihood"
) = result(
"Likelihood"
).ToString()
Next
Return
tbl
End
Function
Protected
Function
GetChildGridTable()
As
DataTable
Dim
oSiteCollection
As
SPSite = SPContext.Current.Site
Dim
oWebsiteRoot
As
SPWeb = oSiteCollection.OpenWeb()
Dim
myList
As
Microsoft.SharePoint.SPList
myList = oWebsiteRoot.Lists(
"RiskItemDetail"
)
Dim
results
As
SPListItemCollection = myList.Items
Dim
tbl
As
New
DataTable()
tbl.Columns.Add(
"ID"
,
GetType
(
String
))
tbl.Columns.Add(
"RiskItemID"
,
GetType
(
String
))
tbl.Columns.Add(
"RiskConsequence"
,
GetType
(
String
))
tbl.Columns.Add(
"RiskCause"
,
GetType
(
String
))
tbl.Columns.Add(
"CurrentMitigation"
,
GetType
(
String
))
tbl.Columns.Add(
"ProposedMitigation"
,
GetType
(
String
))
tbl.Columns.Add(
"ImplementationPlan"
,
GetType
(
String
))
Dim
row
As
DataRow
For
Each
result
As
SPListItem
In
results
row = tbl.Rows.Add()
row(
"ID"
) = result(
"ID"
).ToString()
row(
"RiskItemID"
) = result(
"RiskItemID"
).ToString().Remove(1)
row(
"RiskConsequence"
) = result(
"RiskConsequence"
).ToString()
row(
"RiskCause"
) = result(
"RiskCause"
).ToString()
row(
"CurrentMitigation"
) = result(
"CurrentMitigation"
).ToString()
row(
"ProposedMitigation"
) = result(
"ProposedMitigation"
).ToString()
row(
"ImplementationPlan"
) = result(
"ImplementationPlan"
).ToString()
Next
Return
tbl
End
Function
Protected
Sub
BindToGrid()
RadGrid1.DataSource = GetParentGridTable().DefaultView
RadGrid1.DataBind()
End
Sub
Protected
Sub
RadGrid1_NeedDataSource(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RadGrid1.NeedDataSource
RadGrid1.DataSource = GetParentGridTable().DefaultView
End
Sub
Protected
Sub
RadGrid2_NeedDataSource(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Dim
grid
As
RadGrid =
DirectCast
(source, RadGrid)
Dim
parentGridItem
As
GridDataItem = TryCast(TryCast(grid.NamingContainer, GridNestedViewItem).ParentItem, GridDataItem)
grid.DataSource = GetChildGridTable().
Select
(
"RiskItemID = "
& parentGridItem.GetDataKeyValue(
"ID"
).ToString())
End
Sub
Protected
Sub
RadGrid1_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridEditableItem
AndAlso
e.Item.IsInEditMode
Then
End
If
If
TypeOf
e.Item
Is
GridDataItem
AndAlso
e.Item.IsInEditMode
Then
Dim
item
As
GridDataItem = TryCast(e.Item, GridDataItem)
Dim
textItem1
As
TextBox =
DirectCast
(item(
"Strategy"
).Controls(0), TextBox)
textItem1.TextMode = TextBoxMode.MultiLine
textItem1.Wrap =
True
textItem1.Width = 400
textItem1.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem1.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem1.Rows = 10
textItem1.Text = textItem1.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem2
As
TextBox =
DirectCast
(item(
"RiskFactor"
).Controls(0), TextBox)
textItem2.TextMode = TextBoxMode.MultiLine
textItem2.Wrap =
True
textItem2.Width = 400
textItem2.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem2.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem2.Rows = 10
textItem2.Text = textItem2.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem3
As
TextBox =
DirectCast
(item(
"RiskOwner"
).Controls(0), TextBox)
textItem3.TextMode = TextBoxMode.MultiLine
textItem3.Wrap =
True
textItem3.Width = 300
textItem3.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem3.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem3.Rows = 3
textItem3.Text = textItem3.Text.Replace(
"<br/>"
, Chr(10))
Dim
ddl1
As
RadComboBox =
DirectCast
(item(
"Impact"
).Controls(0), RadComboBox)
ddl1.Width = 80
ddl1.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
ddl1.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
Dim
ddl2
As
RadComboBox =
DirectCast
(item(
"Likelihood"
).Controls(0), RadComboBox)
ddl2.Width = 80
ddl2.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
ddl2.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
End
If
End
Sub
Protected
Sub
RadGrid2_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
If
TypeOf
e.Item
Is
GridDataItem
AndAlso
e.Item.IsInEditMode
Then
Dim
item
As
GridDataItem = TryCast(e.Item, GridDataItem)
Dim
textItem1
As
TextBox =
DirectCast
(item(
"RiskConsequence"
).Controls(0), TextBox)
textItem1.TextMode = TextBoxMode.MultiLine
textItem1.Wrap =
True
textItem1.Width = 250
textItem1.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem1.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem1.Rows = 10
textItem1.Text = textItem1.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem2
As
TextBox =
DirectCast
(item(
"RiskCause"
).Controls(0), TextBox)
textItem2.TextMode = TextBoxMode.MultiLine
textItem2.Wrap =
True
textItem2.Width = 250
textItem2.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem2.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem2.Rows = 10
textItem2.Text = textItem2.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem3
As
TextBox =
DirectCast
(item(
"CurrentMitigation"
).Controls(0), TextBox)
textItem3.TextMode = TextBoxMode.MultiLine
textItem3.Wrap =
True
textItem3.Width = 300
textItem3.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem3.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem3.Rows = 10
textItem3.Text = textItem3.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem4
As
TextBox =
DirectCast
(item(
"ProposedMitigation"
).Controls(0), TextBox)
textItem4.TextMode = TextBoxMode.MultiLine
textItem4.Wrap =
True
textItem4.Width = 300
textItem4.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem4.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem4.Rows = 10
textItem4.Text = textItem4.Text.Replace(
"<br/>"
, Chr(10))
Dim
textItem5
As
TextBox =
DirectCast
(item(
"ImplementationPlan"
).Controls(0), TextBox)
textItem5.TextMode = TextBoxMode.MultiLine
textItem5.Wrap =
True
textItem5.Width = 150
textItem5.Style.Add(
"border"
,
"1px solid #CCCCCC"
)
textItem5.Style.Add(
"font"
,
"10pt tahoma,sans-serif"
)
textItem5.Rows = 10
textItem5.Text = textItem5.Text.Replace(
"<br/>"
, Chr(10))
End
If
End
Sub
Protected
Sub
RadGrid1_ItemInserted(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridInsertedEventArgs)
Handles
RadGrid1.ItemInserted
If
Not
e.Exception
Is
Nothing
Then
e.ExceptionHandled =
True
e.KeepInInsertMode =
True
SetMessage(
"Product cannot be inserted. Reason: "
+ e.Exception.Message)
Else
SetMessage(
"New product is inserted!"
)
End
If
End
Sub
Protected
Sub
RadGrid1_ItemUpdated(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridUpdatedEventArgs)
Handles
RadGrid1.ItemUpdated
Dim
item
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
Dim
id
As
String
= item.GetDataKeyValue(
"ID"
).ToString()
If
Not
e.Exception
Is
Nothing
Then
e.KeepInEditMode =
True
e.ExceptionHandled =
True
SetMessage(
"Risk "
+ id +
" cannot be updated. Reason: "
+ e.Exception.Message)
Else
SetMessage(
"Risk "
+ id +
" is updated!"
)
End
If
End
Sub
Private
Sub
DisplayMessage(
ByVal
text
As
String
)
RadGrid1.Controls.Add(
New
LiteralControl(
String
.Format(
"<span style='color:red'>{0}</span>"
, text)))
End
Sub
Private
Sub
SetMessage(
ByVal
message
As
String
)
gridMessage = message
End
Sub
Private
gridMessage
As
String
=
Nothing
Protected
Sub
RadGrid1_DataBound(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
RadGrid1.DataBound
If
Not
String
.IsNullOrEmpty(gridMessage)
Then
DisplayMessage(gridMessage)
End
If
End
Sub
End
Class
<
MasterTableView
TableLayout
=
"Fixed"
HierarchyDefaultExpanded
=
"true"
CommandItemDisplay
=
"Top"
EnableNoRecordsTemplate
=
"true"
>
<
Columns
>
......
</
Columns
>
<
DetailTables
>
<
telerik:GridTableView
DataKeyNames
=
"AccountID"
Width
=
"100%"
DataMember
=
"FundBalance"
HierarchyLoadMode
=
"ServerBind"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"AccountID"
MasterKeyField
=
"AccountID"
/>
</
ParentTableRelation
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"AccountID"
UniqueName
=
"AccountID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FundTypeID"
UniqueName
=
"FundTypeID"
>
</
telerik:GridBoundColumn
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginBalanceShares"
DataField
=
"BeginBalanceShares"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginPrice"
DataField
=
"BeginPrice"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"BeginBalanceDollars"
DataField
=
"BeginBalanceDollars"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"EndBalanceShares"
DataField
=
"EndBalanceShares"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
</
MasterTableView
>
My datasource is defined as:
public static DataTable ListByPlanAndDateRange(int planID, DateTime beginDate, DateTime endDate)
{
DataSet ds = DBRoutines.wusp_PeriodSummaryByFund_ListByPlanAndDateRange(planID, beginDate, endDate);
ds.Tables[0].TableName = "FundBalance";
ds.Tables[1].TableName = "SourceContribution";
ds.Relations.Add("BalanceRelation", ds.Tables[0].Columns[Fields.FundID], ds.Tables[1].Columns[Fields.FundID], false);
return ds.Tables[0];
}