Hi Guys,
I'm using the filter functionality in the RadGrid & i've enabled/disabled certain columns to only have certain fields on which the user can filter data.
However, when i use the filter on any column, i get the following error:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: is neither a DataColumn nor a DataRelation for table DefaultView.
As you can see, there is a blank entry in the err msg where it should normall state a column.
Does anyone know why this is happening?
My code is as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TotalTargets.aspx.cs" Inherits="WorkStreamList"
StylesheetTheme="SkinFile" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>Totals for Annual Targets</
title
>
<
link
href
=
"General.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<!-- custom head section -->
<
style
type
=
"text/css"
>
.MyImageButton
{
cursor: hand;
}
.EditFormHeader td
{
font-size: 14px;
padding: 4px !important;
color: #0066cc;
}
</
style
>
<!-- end of custom head section -->
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:scriptmanager
runat
=
"server"
></
asp:scriptmanager
>
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
runat
=
"server"
DecoratedControls
=
"All"
/>
<
table
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
style
=
"height:30px; width:800px;"
>
<
tr
><
td
style
=
"width:80%"
>
<
img
id
=
"Img1"
alt
=
"Savings Plans"
src
=
"Pics/SavingsPlansTitle2.gif"
runat
=
"server"
/>
<
asp:Label
ID
=
"lblUserName"
runat
=
"server"
Font-Bold
=
"True"
Font-Size
=
"Small"
ForeColor
=
"Black"
Style
=
"font-size: Small"
></
asp:Label
>
</
td
><
td
style
=
"width:20%"
align
=
"right"
>
<
asp:UpdateProgress
runat
=
"server"
ID
=
"updateprogress1"
>
<
ProgressTemplate
>
<
div
class
=
"progress"
>
<
img
alt
=
""
src
=
"Pics/load.gif"
style
=
"width: 30px; height: 30px; vertical-align:middle"
/><
b
><
span
style
=
"font-size: small; color: #FF0000"
>
Please Wait...</
span
></
b
>
</
div
>
</
ProgressTemplate
>
</
asp:UpdateProgress
>
</
td
></
tr
>
</
table
>
<
div
id
=
"MainSection"
runat
=
"server"
style
=
"width: 800px;"
>
<
div
style
=
"width: 800px; text-align: center;"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel3"
runat
=
"server"
>
<
ContentTemplate
>
<
asp:Label
ID
=
"lblError"
runat
=
"server"
Font-Bold
=
"True"
Font-Size
=
"Medium"
ForeColor
=
"Red"
Style
=
"font-size: small"
></
asp:Label
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
div
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:SavingsPlanDBConnectionString %>"
SelectCommand="SELECT [id], [BusinessCode], [BusinessUnit], [Directorate], [TotalTarget], [FinancialYear], [SortOrder] FROM [OverallTargets]"
DeleteCommand="DELETE FROM [OverallTargets] WHERE [id] = @id"
InsertCommand="INSERT INTO [OverallTargets] ([BusinessCode], [BusinessUnit], [Directorate], [TotalTarget], [FinancialYear], [SortOrder]) VALUES (@BusinessCode, @BusinessUnit, @Directorate, @TotalTarget, @FinancialYear, @SortOrder)"
UpdateCommand="UPDATE [OverallTargets] SET [BusinessCode] = @BusinessCode, [BusinessUnit] = @BusinessUnit, [Directorate] = @Directorate, [TotalTarget] = @TotalTarget, [FinancialYear] = @FinancialYear, [SortOrder]=@SortOrder WHERE [id] = @id" >
<
DeleteParameters
>
<
asp:Parameter
Name
=
"id"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"BusinessCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"BusinessUnit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Directorate"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"FinancialYear"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"TotalTarget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"SortOrder"
Type
=
"Int16"
/>
<
asp:Parameter
Name
=
"id"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"BusinessCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"BusinessUnit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Directorate"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"FinancialYear"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"TotalTarget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"SortOrder"
Type
=
"Int16"
/>
</
InsertParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"DS_Directorate"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DataAcademy400ConnectionString %>"
SelectCommand="SELECT DISTINCT LOWER(DirectorateDescription) AS Directorate FROM ORACLE_DS_GL_Hierarchy WHERE (DirectorateCode <> 'BS') ORDER BY Directorate" >
</
asp:SqlDataSource
>
<
br
/>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
Text
=
"Total Targets:"
ForeColor
=
"Black"
Font-Size
=
"Medium"
Font-Bold
=
"True"
Font-Names
=
"Monotype Corsiva,Verdana"
></
asp:Label
>
<
br
/>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function RowDblClick(sender, eventArgs) {
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
HorizontalAlign
=
"Center"
Visible
=
"true"
Skin
=
"Web20"
RegisterWithScriptManager
=
"true"
Width
=
"800px"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
GridLines
=
"None"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
Skin
=
"Web20"
Width
=
"800px"
AllowFilteringByColumn
=
"True"
OnItemUpdated
=
"RadGrid1_ItemUpdated"
OnItemDeleted
=
"RadGrid1_ItemDeleted"
OnItemInserted
=
"RadGrid1_ItemInserted"
OnDataBound
=
"RadGrid1_DataBound"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
onitemcommand
=
"RadGrid1_ItemCommand"
AllowMultiRowEdit
=
"false"
AllowMultiRowSelection
=
"false"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
AlternatingItemStyle
BackColor
=
"#E8F1FF"
/>
<
MasterTableView
Width
=
"800px"
CommandItemDisplay
=
"TopAndBottom"
DataKeyNames
=
"Id"
DataSourceID
=
"SqlDataSource1"
HorizontalAlign
=
"NotSet"
AutoGenerateColumns
=
"False"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
></
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
></
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
>
<
ItemStyle
CssClass
=
"MyImageButton"
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Id"
UniqueName
=
"Id"
AllowFiltering
=
"false"
EditFormColumnIndex
=
"1"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblId"
Text='<%# Eval("Id") %>'></
asp:Label
>
</
ItemTemplate
>
<
InsertItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblId"
Text='<%# Eval("Id") %>'></
asp:Label
>
</
InsertItemTemplate
>
<
EditItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblId"
Text='<%# Eval("Id") %>'></
asp:Label
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Directorate"
SortExpression
=
"Directorate"
UniqueName
=
"Directorate"
AllowFiltering
=
"true"
EditFormColumnIndex
=
"0"
FilterControlWidth
=
"80%"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblDirectorate"
Text='<%# Eval("Directorate") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Directorate"
DataSourceID
=
"DS_Directorate"
DataTextField
=
"Directorate"
DataValueField
=
"Directorate"
HeaderText
=
"Directorate"
Skin
=
"Web20"
SelectedValue='<%# Bind("Directorate") %>'
UniqueName="Directorate" ID="cmbDirectorate" ColumnEditorID="GridDropDownColumnEditor2">
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator5"
ControlToValidate
=
"cmbDirectorate"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Directorate"
DataSourceID
=
"DS_Directorate"
DataTextField
=
"Directorate"
DataValueField
=
"Directorate"
HeaderText
=
"Directorate"
Skin
=
"Web20"
SelectedValue='<%# Bind("Directorate") %>'
UniqueName="Directorate" ID="cmbDirectorate" ColumnEditorID="GridDropDownColumnEditor2">
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator6"
ControlToValidate
=
"cmbDirectorate"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Business Unit"
SortExpression
=
"BusinessUnit"
UniqueName
=
"BusinessUnit"
AllowFiltering
=
"true"
EditFormColumnIndex
=
"0"
FilterControlWidth
=
"80%"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblBusinessUnit"
Text='<%# Eval("BusinessUnit") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Business Unit"
DataSourceID
=
"DS_BusinessUnit"
DataTextField
=
"BusinessUnit"
DataValueField
=
"BusinessUnit"
HeaderText
=
"BusinessUnit"
Skin
=
"Web20"
SelectedValue='<%# Bind("BusinessUnit") %>'
UniqueName="BusinessUnit" ID="cmbBusinessUnit" ColumnEditorID="GridDropDownColumnEditor2">
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator3"
ControlToValidate
=
"cmbBusinessUnit"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Business Unit"
DataSourceID
=
"DS_BusinessUnit"
DataTextField
=
"BusinessUnit"
DataValueField
=
"BusinessUnit"
HeaderText
=
"BusinessUnit"
Skin
=
"Web20"
SelectedValue='<%# Bind("BusinessUnit") %>'
UniqueName="BusinessUnit" ID="cmbBusinessUnit" ColumnEditorID="GridDropDownColumnEditor2">
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator4"
ControlToValidate
=
"cmbBusinessUnit"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Business Code"
SortExpression
=
"BusinessCode"
UniqueName
=
"BusinessCode"
AllowFiltering
=
"true"
EditFormColumnIndex
=
"0"
FilterControlWidth
=
"70%"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblBusinessCode"
Text='<%# Eval("BusinessCode") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
>
<
telerik:RadTextBox
runat
=
"server"
Width
=
"250px"
Text='<%# Bind("BusinessCode") %>' ID="txtBusinessCode" Visible="false" >
</
telerik:RadTextBox
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
>
<
telerik:RadTextBox
runat
=
"server"
Width
=
"250px"
Text='<%# Bind("BusinessCode") %>' ID="txtBusinessCode" Visible="false" >
</
telerik:RadTextBox
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Year"
SortExpression
=
"FinancialYear"
UniqueName
=
"FinancialYear"
AllowFiltering
=
"true"
EditFormColumnIndex
=
"1"
FilterControlWidth
=
"70%"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblFinancialYear"
Text='<%# Eval("FinancialYear") %>' Width="70px"></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Financial Year"
HeaderText
=
"Year"
Skin
=
"Web20"
SelectedValue='<%# Bind("FinancialYear") %>'
UniqueName="FinancialYear" ID="cmbFinancialYear" ColumnEditorID="GridDropDownColumnEditor2">
<
Items
>
<
telerik:RadComboBoxItem
Value
=
" "
Text
=
" "
/>
<
telerik:RadComboBoxItem
Value
=
"2009-10"
Text
=
"2009-10"
/>
<
telerik:RadComboBoxItem
Value
=
"2010-11"
Text
=
"2010-11"
/>
<
telerik:RadComboBoxItem
Value
=
"2011-12"
Text
=
"2011-12"
/>
<
telerik:RadComboBoxItem
Value
=
"2012-13"
Text
=
"2012-13"
/>
<
telerik:RadComboBoxItem
Value
=
"2013-14"
Text
=
"2013-14"
/>
<
telerik:RadComboBoxItem
Value
=
"2014-15"
Text
=
"2014-15"
/>
<
telerik:RadComboBoxItem
Value
=
"2015-16"
Text
=
"2015-16"
/>
<
telerik:RadComboBoxItem
Value
=
"2016-17"
Text
=
"2016-17"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator8"
ControlToValidate
=
"cmbFinancialYear"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
>
<
telerik:RadComboBox
runat
=
"server"
Width
=
"250px"
Height
=
"150px"
EmptyMessage
=
"Select a Financial Year"
HeaderText
=
"Year"
Skin
=
"Web20"
SelectedValue='<%# Bind("FinancialYear") %>'
UniqueName="FinancialYear" ID="cmbFinancialYear" ColumnEditorID="GridDropDownColumnEditor2">
<
Items
>
<
telerik:RadComboBoxItem
Value
=
" "
Text
=
" "
/>
<
telerik:RadComboBoxItem
Value
=
"2009-10"
Text
=
"2009-10"
/>
<
telerik:RadComboBoxItem
Value
=
"2010-11"
Text
=
"2010-11"
/>
<
telerik:RadComboBoxItem
Value
=
"2011-12"
Text
=
"2011-12"
/>
<
telerik:RadComboBoxItem
Value
=
"2012-13"
Text
=
"2012-13"
/>
<
telerik:RadComboBoxItem
Value
=
"2013-14"
Text
=
"2013-14"
/>
<
telerik:RadComboBoxItem
Value
=
"2014-15"
Text
=
"2014-15"
/>
<
telerik:RadComboBoxItem
Value
=
"2015-16"
Text
=
"2015-16"
/>
<
telerik:RadComboBoxItem
Value
=
"2016-17"
Text
=
"2016-17"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator9"
ControlToValidate
=
"cmbFinancialYear"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Total Target"
SortExpression
=
"TotalTarget"
UniqueName
=
"TotalTarget"
AllowFiltering
=
"false"
EditFormColumnIndex
=
"1"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblTotalTarget"
Text='<%# Eval("TotalTarget", "{0:C0}") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
><
telerik:RadNumericTextBox
BackColor
=
"#6B8DC2"
EmptyMessage
=
"Enter Overall Target Value"
Font-Bold
=
"True"
ForeColor
=
"White"
Skin
=
"Web20"
runat
=
"server"
ID
=
"tbTotalTarget"
Width
=
"245px"
DbValue='<%# Bind("TotalTarget") %>'></
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"tbTotalTarget"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
><
telerik:RadNumericTextBox
BackColor
=
"#6B8DC2"
EmptyMessage
=
"Enter Overall Target Value"
Font-Bold
=
"True"
ForeColor
=
"White"
Skin
=
"Web20"
runat
=
"server"
ID
=
"tbTotalTarget"
Width
=
"245px"
DbValue='<%# Bind("TotalTarget") %>'></
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"tbTotalTarget"
ErrorMessage
=
"*"
runat
=
"server"
>
</
asp:RequiredFieldValidator
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"SortOrder"
UniqueName
=
"SortOrder"
AllowFiltering
=
"false"
Visible
=
"false"
EditFormColumnIndex
=
"1"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblSortOrder"
Text='<%# Eval("SortOrder") %>'></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
span
>
<
telerik:RadTextBox
runat
=
"server"
Width
=
"250px"
Text='<%# Bind("SortOrder") %>' ID="txtSortOrder" Visible="false" >
</
telerik:RadTextBox
>
</
span
>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
span
>
<
telerik:RadTextBox
runat
=
"server"
Width
=
"250px"
Text='<%# Bind("SortOrder") %>' ID="txtSortOrder" Visible="false" >
</
telerik:RadTextBox
>
</
span
>
</
InsertItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn"
>
<
ItemStyle
HorizontalAlign
=
"Center"
CssClass
=
"MyImageButton"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
ColumnNumber
=
"2"
CaptionDataField
=
"Id"
CaptionFormatString
=
"Edit properties of Record Id {0}"
InsertCaption
=
"New Record"
>
<
FormTableItemStyle
Wrap
=
"False"
></
FormTableItemStyle
>
<
FormCaptionStyle
CssClass
=
"EditFormHeader"
></
FormCaptionStyle
>
<
FormMainTableStyle
GridLines
=
"None"
CellSpacing
=
"0"
CellPadding
=
"3"
BackColor
=
"#F2FFEC"
Width
=
"100%"
/>
<
FormTableStyle
CellSpacing
=
"0"
CellPadding
=
"2"
Height
=
"60px"
BackColor
=
"#F2FFEC"
/>
<
FormTableAlternatingItemStyle
Wrap
=
"False"
></
FormTableAlternatingItemStyle
>
<
EditColumn
ButtonType
=
"ImageButton"
InsertText
=
"Insert Record"
UpdateText
=
"Update Record"
UniqueName
=
"EditCommandColumn1"
CancelText
=
"Cancel edit"
>
</
EditColumn
>
<
FormTableButtonRowStyle
HorizontalAlign
=
"Right"
CssClass
=
"EditFormButtonRow"
></
FormTableButtonRowStyle
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
<
EditItemStyle
BackColor
=
"#F2FFEC"
/>
<
ActiveItemStyle
BackColor
=
"#FFF8D9"
BorderColor
=
"#FFF8D9"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
/>
<
SelectedItemStyle
BackColor
=
"#FFF8D9"
BorderColor
=
"#FFF8D9"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
/>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Web20"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor1"
runat
=
"server"
TextBoxStyle-Width
=
"200px"
Visible
=
"false"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor2"
runat
=
"server"
TextBoxStyle-Width
=
"200px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxColumnEditor3"
runat
=
"server"
TextBoxStyle-Width
=
"200px"
/>
<
telerik:GridDropDownListColumnEditor
ID
=
"GridDropDownColumnEditor1"
runat
=
"server"
DropDownStyle-Width
=
"300px"
Visible
=
"false"
>
<
DropDownStyle
Width
=
"300px"
></
DropDownStyle
>
</
telerik:GridDropDownListColumnEditor
>
<
telerik:GridDropDownListColumnEditor
ID
=
"GridDropDownColumnEditor2"
runat
=
"server"
DropDownStyle-Width
=
"300px"
/>
<
telerik:GridDropDownListColumnEditor
ID
=
"GridDropDownColumnEditor3"
runat
=
"server"
DropDownStyle-Width
=
"300px"
/>
<
telerik:GridNumericColumnEditor
ID
=
"GridNumericColumnEditor1"
runat
=
"server"
NumericTextBox-Width
=
"200px"
/>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:SavingsPlanDBConnectionString %>"
SelectCommand="SELECT [id], [BusinessCode], [BusinessUnit], [Directorate], [TotalTarget], [SortOrder] FROM [OverallTargets]"
FilterExpression="id='{0}'"
DeleteCommand="DELETE FROM [OverallTargets] WHERE [id] = @id"
InsertCommand="INSERT INTO [OverallTargets] ([BusinessCode], [BusinessUnit], [Directorate], [TotalTarget], [SortOrder]) VALUES (@BusinessCode, @BusinessUnit, @Directorate, @TotalTarget, @SortOrder)"
UpdateCommand="UPDATE [OverallTargets] SET [BusinessCode] = @BusinessCode, [BusinessUnit] = @BusinessUnit, [Directorate] = @Directorate, [TotalTarget] = @TotalTarget, [SortOrder] = @SortOrder WHERE [id] = @id">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"id"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"BusinessCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"BusinessUnit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Directorate"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"TotalTarget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"SortOrder"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"id"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"BusinessCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"BusinessUnit"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Directorate"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"TotalTarget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"SortOrder"
Type
=
"Int32"
/>
</
InsertParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"DS_BusinessUnit"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DataAcademy400ConnectionString %>"
SelectCommand="SELECT DISTINCT BusinessUnitCode, CASE BusinessUnitCode WHEN 'C1' THEN 'Corporate' WHEN 'F1' THEN 'Facilities' WHEN 'G1' THEN 'Group 1 - Emergency Services' WHEN 'G2' THEN 'Group 2 - Planned Inpatient Care' WHEN 'G3' THEN 'Group 3 - Ambulatory Care' WHEN 'G4' THEN 'Group 4 - Clinical Support' WHEN 'G5' THEN 'Group 5 - Womens & Children' ELSE 'ERROR' END AS BusinessUnit FROM ORACLE_DS_GL_Hierarchy WHERE (BusinessUnitCode NOT IN ('BSBU', 'C2', '3A', '9A')) ORDER BY BusinessUnitCode, BusinessUnit">
</
asp:SqlDataSource
>
<
br
/><
br
/>
<
asp:LinkButton
ID
=
"btnHome"
OnClick
=
"btnHome_Click"
runat
=
"server"
CausesValidation
=
"False"
Text="<img
style
=
'v-align:bottom; margin-top:3px;Border-style:none;'
src
=
'Pics/home2.gif'
alt
=
'Back To Home Page'
>"></
asp:LinkButton
>
Back To Home Page
<
br
/><
br
/>
<
asp:LinkButton
ID
=
"btnBack"
OnClick
=
"btnBack_Click"
runat
=
"server"
CausesValidation
=
"False"
Text="<img
style
=
'v-align:bottom; margin-top:3px;Border-style:none;'
src
=
'Pics/back.png'
alt
=
'Back To Home Page'
>"></
asp:LinkButton
>
Back To Reference Tables Page
</
div
>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
public
partial
class
WorkStreamList : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
this
.lblError.ForeColor = System.Drawing.Color.White;
this
.lblError.Text =
"-"
;
this
.lblUserName.ForeColor = System.Drawing.Color.Black;
String conn;
String SQL;
System.Data.SqlClient.SqlConnection Con =
new
System.Data.SqlClient.SqlConnection();
System.Data.SqlClient.SqlCommand com =
new
System.Data.SqlClient.SqlCommand();
System.Data.SqlClient.SqlDataReader RDR;
String @strUserName =
this
.User.Identity.Name.ToString();
String strWindowsUserName;
int
CountPos = strUserName.IndexOf(@
"\"
);
//hide edit options as default & enable for only Admin users
this
.MainSection.Visible =
false
;
if
(CountPos > 0)
{
strUserName = strUserName.Substring(CountPos, strUserName.Length - (CountPos));
strWindowsUserName = strUserName.Substring(1, strUserName.Length - 1);
}
else
{
strWindowsUserName =
"Error"
;
}
conn = System.Configuration.ConfigurationManager.ConnectionStrings[
"SavingsPlanDBConnectionString"
].ConnectionString;
Con.ConnectionString = conn;
com.Connection = Con;
SQL =
"SELECT Permission From Users where username='"
+ strWindowsUserName +
"'"
;
com.CommandText = SQL;
com.CommandType = System.Data.CommandType.Text;
Con.Open();
RDR = com.ExecuteReader();
if
(RDR.HasRows)
{
// Call Read before accessing data.
while
(RDR.Read())
{
if
(RDR[
"permission"
].ToString() ==
"Admin"
)
{
this
.MainSection.Visible =
true
;
}
else
{
this
.lblUserName.ForeColor = System.Drawing.Color.Red;
this
.lblUserName.Text =
"Error: You do not have the required permissions to access this page! Please contact the systems team for further info."
;
}
}
}
else
{
this
.lblUserName.ForeColor = System.Drawing.Color.Red;
this
.lblUserName.Text =
"Error: You do not have the required permissions to access this page! Please contact the systems team for further info."
;
}
RDR.Close();
RDR =
null
;
Con.Close();
Con =
null
;
}
protected
void
btnHome_Click(
object
sender, EventArgs e)
{
try
{
Response.Redirect(
"Default.aspx"
);
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
btnBack_Click(
object
sender, EventArgs e)
{
try
{
Response.Redirect(
"RefTable.aspx"
);
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
ValidateCurrency(
object
sender, ServerValidateEventArgs args)
{
try
{
string
strCurrencyValue;
strCurrencyValue = args.Value.ToString();
//check to see if value entered is empty or null - if so then set to null to allow non-mandatory fields to update
if
(strCurrencyValue ==
""
|| strCurrencyValue ==
null
)
{
args.IsValid =
true
;
}
else
{
strCurrencyValue = strCurrencyValue.Replace(
"£"
,
""
).Replace(
","
,
""
).Replace(
"$"
,
""
);
args.IsValid = Functions.IsNumeric(strCurrencyValue);
}
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
RadGrid1_ItemUpdated(
object
source, Telerik.Web.UI.GridUpdatedEventArgs e)
{
try
{
GridEditableItem item = (GridEditableItem)e.Item;
String id = item.GetDataKeyValue(
"Id"
).ToString();
if
(e.Exception !=
null
)
{
e.KeepInEditMode =
true
;
e.ExceptionHandled =
true
;
SetMessage(
"Record with Id "
+ id +
" cannot be updated. Reason: "
+ e.Exception.Message);
}
else
{
SetMessage(
"Record with Id "
+ id +
" is updated!"
);
}
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
RadGrid1_ItemInserted(
object
source, GridInsertedEventArgs e)
{
try
{
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
SetMessage(
"Record cannot be inserted. Reason: "
+ e.Exception.Message);
}
else
{
SetMessage(
"New Record is inserted!"
);
}
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
RadGrid1_ItemDeleted(
object
source, GridDeletedEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.Item;
String id = dataItem.GetDataKeyValue(
"Id"
).ToString();
try
{
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
SetMessage(
"Record with Id "
+ id +
" cannot be deleted. Reason: "
+ e.Exception.Message);
}
else
{
SetMessage(
"Record with Id "
+ id +
" is deleted!"
);
}
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
private
void
DisplayMessage(
string
text)
{
RadGrid1.Controls.Add(
new
LiteralControl(
string
.Format(
"<span style='color:red'>{0}</span>"
, text)));
}
private
void
SetMessage(
string
message)
{
gridMessage = message;
}
private
string
gridMessage =
null
;
protected
void
RadGrid1_DataBound(
object
sender, EventArgs e)
{
if
(RadGrid1.MasterTableView.IsItemInserted)
{
}
if
(!
string
.IsNullOrEmpty(gridMessage))
{
DisplayMessage(gridMessage);
}
}
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
try
{
if
((e.Item
is
GridEditFormItem) && (e.Item.IsInEditMode))
{
GridEditFormItem editform = (GridEditFormItem)e.Item;
editform[
"BusinessCode"
].Parent.Visible =
false
;
editform[
"SortOrder"
].Parent.Visible =
false
;
}
if
((e.Item
is
GridEditFormInsertItem))
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
RadNumericTextBox txt = (RadNumericTextBox)item.FindControl(
"tbTotalTarget"
);
RadComboBox cmbBusinessUnit = (RadComboBox)item.FindControl(
"cmbBusinessUnit"
);
cmbBusinessUnit.Items.Insert(0,
new
RadComboBoxItem(
""
));
RadComboBox cmbDirectorate = (RadComboBox)item.FindControl(
"cmbDirectorate"
);
cmbDirectorate.Items.Insert(0,
new
RadComboBoxItem(
""
));
}
if
((e.Item.IsInEditMode) && (e.Item
is
GridEditFormItem) && (!(e.Item
is
GridEditFormInsertItem)))
{
GridEditFormItem item = (GridEditFormItem)e.Item;
RadNumericTextBox txt = (RadNumericTextBox)item.FindControl(
"tbTotalTarget"
);
RadComboBox ddl = (RadComboBox)item.FindControl(
"cmbBusinessUnit"
);
//ddl.Items.Insert(0, new RadComboBoxItem(""));
}
}
catch
(Exception ex)
{
this
.lblError.ForeColor = System.Drawing.Color.Red;
this
.lblError.Text =
"Error: "
+ ex.Message.ToString() +
" \n Error Source: "
+ ex.Source.ToString();
}
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"InitInsert"
)
{
}
if
(e.CommandName ==
"PerformInsert"
&& e.Item
is
GridEditFormInsertItem)
{
GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
RadComboBox cmb = (RadComboBox)item.FindControl(
"cmbBusinessUnit"
);
RadTextBox txtCode = (RadTextBox)item.FindControl(
"txtBusinessCode"
);
RadTextBox txtSortOrder = (RadTextBox)item.FindControl(
"txtSortOrder"
);
switch
(cmb.SelectedValue.ToLower().Substring(0, 7))
{
case
"corpora"
:
txtCode.Text =
"C"
;
txtSortOrder.Text =
"7"
;
break
;
case
"facilit"
:
txtCode.Text =
"F"
;
txtSortOrder.Text =
"6"
;
break
;
case
"group 1"
:
txtCode.Text =
"G1"
;
txtSortOrder.Text =
"1"
;
break
;
case
"group 2"
:
txtCode.Text =
"G2"
;
txtSortOrder.Text =
"2"
;
break
;
case
"group 3"
:
txtCode.Text =
"G3"
;
txtSortOrder.Text =
"3"
;
break
;
case
"group 4"
:
txtCode.Text =
"G4"
;
txtSortOrder.Text =
"4"
;
break
;
case
"group 5"
:
txtCode.Text =
"G5"
;
txtSortOrder.Text =
"5"
;
break
;
default
:
txtCode.Text =
"EE"
;
txtSortOrder.Text =
"0"
;
break
;
}
}
if
(e.CommandName ==
"Update"
&& e.Item
is
GridEditFormItem)
{
GridEditFormItem item = (GridEditFormItem)e.Item;
RadComboBox cmb = (RadComboBox)item.FindControl(
"cmbBusinessUnit"
);
RadTextBox txtCode = (RadTextBox)item.FindControl(
"txtBusinessCode"
);
RadTextBox txtSortOrder = (RadTextBox)item.FindControl(
"txtSortOrder"
);
switch
(cmb.SelectedValue.ToLower().Substring(0, 7))
{
case
"corpora"
:
txtCode.Text =
"C"
;
txtSortOrder.Text =
"7"
;
break
;
case
"facilit"
:
txtCode.Text =
"F"
;
txtSortOrder.Text =
"6"
;
break
;
case
"group 1"
:
txtCode.Text =
"G1"
;
txtSortOrder.Text =
"1"
;
break
;
case
"group 2"
:
txtCode.Text =
"G2"
;
txtSortOrder.Text =
"2"
;
break
;
case
"group 3"
:
txtCode.Text =
"G3"
;
txtSortOrder.Text =
"3"
;
break
;
case
"group 4"
:
txtCode.Text =
"G4"
;
txtSortOrder.Text =
"4"
;
break
;
case
"group 5"
:
txtCode.Text =
"G5"
;
txtSortOrder.Text =
"5"
;
break
;
default
:
txtCode.Text =
"EE"
;
txtSortOrder.Text =
"0"
;
break
;
}
}
}
}
Hi
When I create a webform and try to drag and drop on it RADWindow for instance then I don't find the RAD Controls in the toolbox. What am I missing?
Thanks
Regards
PS: Sorry for typos in title.
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
Have I missed something or is it a known bug ?
Many Thanks,
Aash.