I have a grid that is bound to a SQL DataSource control. There are 6 GridBoundColumns displayed. I have a CommandItemTemplate for editing the records. When I click the edit selected row button, a custom edit form displays below the row displaying 30 different fields. This is a FormTemplate. Once I am done editing, I click the update button and SQL DataSource Updating event is kicked off where I need to set the values for the parameters of the SQL DataSource . This is a stored proc that gets executed by the datasource.
How do I access the templated fields inside the SQL DataSource Updating event?
How do I access the templated fields inside the SQL DataSource Updating event?
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="NTA_PLAN_MASTER.aspx.cs" Inherits="NTA_Tables.NTA_PLAN_MASTER" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"HeaderContent"
runat
=
"server"
ContentPlaceHolderID
=
"HeadContent"
>
<%-- <
style
type
=
"text/css"
>
.rbPrimaryIcon.rbToggleCheckbox {
background-image: none !important;
}
</
style
>
--%>
</
asp:Content
>
<
asp:Content
ID
=
"BodyContent"
runat
=
"server"
ContentPlaceHolderID
=
"MainContent"
>
<
telerik:RadAjaxManagerProxy
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"divMsgs"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManagerProxy
>
<
p
id
=
"divMsgs"
runat
=
"server"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
EnableViewState
=
"False"
Font-Bold
=
"True"
ForeColor
=
"#FF8080"
/>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
EnableViewState
=
"False"
Font-Bold
=
"True"
ForeColor
=
"#00C000"
/>
</
p
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
CssClass
=
"RadGrid"
GridLines
=
"None"
AllowPaging
=
"True"
PageSize
=
"10"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
ShowStatusBar
=
"true"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
DataSourceID
=
"sdsNTA_PLAN_MASTER"
OnItemDeleted
=
"RadGrid1_ItemDeleted"
OnItemInserted
=
"RadGrid1_ItemInserted"
OnItemUpdated
=
"RadGrid1_ItemUpdated"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnPreRender
=
"RadGrid1_PreRender"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"TopAndBottom"
DataSourceID
=
"sdsNTA_PLAN_MASTER"
DataKeyNames
=
"COMPANY,PLAN_CODE,PRODUCT_CODE,PLAN_LEVEL,STATE_CODE,EFFECTIVE_DATE"
>
<
CommandItemTemplate
>
<
div
style
=
"padding: 5px 5px;"
>
<
asp:LinkButton
ID
=
"btnEditSelected"
runat
=
"server"
CommandName
=
"EditSelected"
Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Edit.png"
/>Edit selected</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"btnUpdateEdited"
runat
=
"server"
CommandName
=
"UpdateEdited"
Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Update.png"
/>Update</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"btnCancel"
runat
=
"server"
CommandName
=
"CancelAll"
Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Cancel.png"
/>Cancel editing</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"LinkButton2"
runat
=
"server"
CommandName
=
"InitInsert"
Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/AddRecord.png"
/>Add new</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"LinkButton3"
runat
=
"server"
CommandName
=
"PerformInsert"
Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Insert.gif"
/> Add this Plan</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"LinkButton1"
OnClientClick
=
"javascript:return confirm('Delete all selected plans?')"
runat
=
"server"
CommandName
=
"DeleteSelected"
><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Delete.png"
/>Delete selected plans</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"LinkButton4"
runat
=
"server"
CommandName
=
"RebindGrid"
><
img
style
=
"border:0px;vertical-align:middle;"
alt
=
""
src
=
"Images/Refresh.png"
/>Refresh plan list</
asp:LinkButton
>
</
div
>
</
CommandItemTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"COMPANY"
HeaderText
=
"Company Code"
DataField
=
"COMPANY"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"PLAN_CODE"
HeaderText
=
"Plan Code"
DataField
=
"PLAN_CODE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"PRODUCT_CODE"
HeaderText
=
"Product Code"
DataField
=
"PRODUCT_CODE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"PLAN_LEVEL"
HeaderText
=
"Plan Level"
DataField
=
"PLAN_LEVEL"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"STATE_CODE"
HeaderText
=
"State Code"
DataField
=
"STATE_CODE"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"EFFECTIVE_DATE"
HeaderText
=
"Effective Date"
DataField
=
"EFFECTIVE_DATE"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
id
=
"Table2"
cellspacing
=
"2"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
rules
=
"none"
style
=
"border-collapse: collapse;"
>
<
tr
class
=
"EditFormHeader"
>
<
td
colspan
=
"6"
style
=
"font-size: small"
>
<
b
>Plan Details</
b
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"6"
>
<
table
id
=
"Table3"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
class
=
"module"
>
<
tr
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Company:
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"cboCompany"
runat
=
"server"
DropDownAutoWidth
=
"Enabled"
Filter
=
"Contains"
MarkFirstMatch
=
"true"
ChangeTextOnKeyBoardNavigation
=
"false"
DataSourceID
=
"sdsNTA_COMPANY"
DataTextField
=
"COMPANY_NAME"
DataValueField
=
"COMPANY_CODE"
selectedValue='<%# Bind("COMPANY") %>' >
</
telerik:RadComboBox
>
</
td
>
<
td
>
Plan Code:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
Text='<%# Bind("PLAN_CODE") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Product Code:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox2"
runat
=
"server"
Text='<%# Bind("PRODUCT_CODE") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Plan Level:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox3"
runat
=
"server"
Text='<%# Bind("PLAN_LEVEL") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
State Code:
</
td
>
<
td
>
<
telerik:RadComboBox
ID
=
"cboSTATE_CODE"
runat
=
"server"
Filter
=
"Contains"
MarkFirstMatch
=
"true"
ChangeTextOnKeyBoardNavigation
=
"false"
DataSourceID
=
"sdsNTA_USA_STATES"
DataTextField
=
"StateName"
DataValueField
=
"StateAbbrev"
selectedValue='<%# Bind("STATE_CODE") %>' >
</
telerik:RadComboBox
>
</
td
>
<
td
>
Effective Date:
</
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"txtEFFECTIVE_DATE"
runat
=
"server"
AutoPostBack
=
"false"
SelectedDate='<%# Bind("EFFECTIVE_DATE") %>'
DateInput-SelectedDate='<%# Bind("EFFECTIVE_DATE") %>' MinDate="1899-12-31" DBSelectedDate='<%# Bind("EFFECTIVE_DATE") %>'>
<
Calendar
ID
=
"Calendar1"
runat
=
"server"
>
</
Calendar
>
</
telerik:RadDatePicker
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Termination Date:
</
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"txtTERMINATION_DATE"
runat
=
"server"
AutoPostBack
=
"false"
SelectedDate='<%# Bind("TERMINATION_DATE") %>'
DateInput-SelectedDate='<%# Bind("TERMINATION_DATE") %>' MinDate="1899-12-31">
<
Calendar
ID
=
"Calendar2"
runat
=
"server"
>
</
Calendar
>
</
telerik:RadDatePicker
>
</
td
>
<
td
>
Plan Type:
</
td
>
<
td
>
<
telerik:RadCombobox
ID
=
"cboPLAN_TYPE"
runat
=
"server"
Filter
=
"Contains"
MarkFirstMatch
=
"true"
ChangeTextOnKeyBoardNavigation
=
"false"
DataSourceID
=
"sdsNTA_PLAN_TYPES"
DataTextField
=
"PLAN_DESC"
DataValueField
=
"PLAN_CODE"
SelectedValue ='<%# Bind("PLAN_TYPE") %>' >
</
telerik:RadCombobox
>
</
td
>
<
td
>
Coverage Type:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox9"
runat
=
"server"
Text='<%# Bind("COVERAGE_TYPE") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Coverage Code:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox10"
runat
=
"server"
Text='<%# Bind("COVERAGE_CODE") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Line Of Business:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox11"
runat
=
"server"
Text='<%# Bind("LINE_OF_BUSINESS") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Specific Form:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox12"
runat
=
"server"
Text='<%# Bind("SPECIFIC_FORM") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Plan Code Desc:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox13"
runat
=
"server"
Text='<%# Bind("PLAN_CODE_DESCR") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Generic Form Desc:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox14"
runat
=
"server"
Text='<%# Bind("GENERIC_FORM_DESCR") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Schedule Page Desc:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox15"
runat
=
"server"
Text='<%# Bind("SCHEDULE_PAGE_DESCR") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Plan Code Abbrev:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox16"
runat
=
"server"
Text='<%# Bind("PLAN_CODE_ABRV_DESCR") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Endorsement Exists?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkENDORSEMENT_EXIST"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("ENDORSEMENT_EXIST").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
<
td
>
Sold Resident State Only?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkSOLD_RES_STATE_ONLY"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("SOLD_RES_STATE_ONLY").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Print Surrender Cost Index Page?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkPRINT_SURR_COST_IDX"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("PRINT_SURR_COST_IDX").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
<
td
>
Extended Benefits Exists?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkEXT_BENF_STATE_SPEC"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("EXT_BENF_STATE_SPEC").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
<
td
>
Print Policy Fee on Schedule Page?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkPRINT_POLICY_FEE"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("PRINT_POLICY_FEE").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Print Insured or Primary Insured?:
</
td
>
<
td
>
<
telerik:RadButton
ID
=
"chkREQUIRED_PLAN"
runat
=
"server"
AutoPostBack
=
"false"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%# Eval("REQUIRED_PLAN").ToString()=="Y" %>'>
<
ToggleStates
>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbCancel"
/>
<
telerik:RadButtonToggleState
PrimaryIconCssClass
=
"rbOk"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
td
>
<
td
>
NTA Plan Code:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox23"
runat
=
"server"
Text='<%# Bind("NTA_PLAN_CODE") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
NTA Generic Form:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox24"
runat
=
"server"
Text='<%# Bind("NTA_GENERIC_FORM") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
NTA Generic Sub Form:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox25"
runat
=
"server"
Text='<%# Bind("NTA_SUB_FORM") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Record Status:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox26"
runat
=
"server"
Text='<%# Bind("RECORD_STATUS") %>'>
</
asp:TextBox
>
</
td
>
<
td
>
Last Updated By:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox27"
runat
=
"server"
Text='<%# Bind("OPERATOR_ID") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"True"
></
Selecting
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"sdsNTA_PLAN_MASTER"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NTAConnectionString %>"
DeleteCommand="NTA_PLAN_MASTER_DELETE" DeleteCommandType="StoredProcedure" InsertCommand="NTA_PLAN_MASTER_INSERT"
InsertCommandType="StoredProcedure" SelectCommand="NTA_PLAN_MASTER_SELECT_ALL"
SelectCommandType="StoredProcedure" UpdateCommand="NTA_PLAN_MASTER_UPDATE" UpdateCommandType="StoredProcedure"
OnUpdating="sdsNTA_PLAN_MASTER_Updating">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"COMPANY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRODUCT_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_LEVEL"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"STATE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"EFFECTIVE_DATE"
Type
=
"String"
></
asp:Parameter
>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"COMPANY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRODUCT_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_LEVEL"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"STATE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"EFFECTIVE_DATE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"TERMINATION_DATE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_TYPE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"COVERAGE_TYPE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"COVERAGE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"LINE_OF_BUSINESS"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SPECIFIC_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"GENERIC_FORM_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SCHEDULE_PAGE_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE_ABRV_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ENDORSEMENT_EXIST"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SOLD_RES_STATE_ONLY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRINT_SURR_COST_IDX"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"EXT_BENF_STATE_SPEC"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRINT_POLICY_FEE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"REQUIRED_PLAN"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_PLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_GENERIC_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_SUB_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"RECORD_STATUS"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"OPERATOR_ID"
Type
=
"String"
DefaultValue
=
""
></
asp:Parameter
>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"ORIGCOMPANY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ORIGPLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ORIGPRODUCT_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ORIGPLAN_LEVEL"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ORIGSTATE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ORIGEFFECTIVE_DATE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"COMPANY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRODUCT_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_LEVEL"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"STATE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"EFFECTIVE_DATE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"TERMINATION_DATE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_TYPE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"COVERAGE_TYPE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"COVERAGE_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"LINE_OF_BUSINESS"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SPECIFIC_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"GENERIC_FORM_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SCHEDULE_PAGE_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PLAN_CODE_ABRV_DESCR"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ENDORSEMENT_EXIST"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"SOLD_RES_STATE_ONLY"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRINT_SURR_COST_IDX"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"EXT_BENF_STATE_SPEC"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"PRINT_POLICY_FEE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"REQUIRED_PLAN"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_PLAN_CODE"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_GENERIC_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"NTA_SUB_FORM"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"RECORD_STATUS"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"OPERATOR_ID"
Type
=
"String"
DefaultValue
=
""
></
asp:Parameter
>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"sdsNTA_USA_STATES"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NTAConnectionString %>"
SelectCommand="NTA_USA_STATES_SELECT_ALL" SelectCommandType="StoredProcedure">
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"sdsNTA_COMPANY"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NTAConnectionString %>"
SelectCommand="NTA_COMPANY_SELECT_EXCLUDE_AllCOMPANY_CODE" SelectCommandType="StoredProcedure">
<
SelectParameters
>
<
asp:Parameter
Name
=
"RecordType"
Type
=
"String"
DefaultValue
=
"A"
></
asp:Parameter
>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"sdsNTA_PLAN_TYPES"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NTAConnectionString %>"
SelectCommand="NTA_PLAN_TYPES_SELECT" SelectCommandType="StoredProcedure">
</
asp:SqlDataSource
>
</
asp:Content
>
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;
namespace
NTA_Tables
{
public
partial
class
NTA_PLAN_MASTER : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
RadGrid1_ItemUpdated(
object
source, Telerik.Web.UI.GridUpdatedEventArgs e)
{
if
(e.Exception !=
null
)
{
e.KeepInEditMode =
true
;
e.ExceptionHandled =
true
;
DisplayMessage(
true
,
"Plan cannot be updated. Reason: "
+ e.Exception.Message);
}
else
{
DisplayMessage(
false
,
"Plan updated"
);
}
}
protected
void
RadGrid1_ItemInserted(
object
source, GridInsertedEventArgs e)
{
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
e.KeepInInsertMode =
true
;
DisplayMessage(
true
,
"New plan cannot be inserted. Reason: "
+ e.Exception.Message);
}
else
{
DisplayMessage(
false
,
"New plan inserted"
);
}
}
protected
void
RadGrid1_ItemDeleted(
object
source, GridDeletedEventArgs e)
{
if
(e.Exception !=
null
)
{
e.ExceptionHandled =
true
;
DisplayMessage(
true
,
"Plan cannot be deleted. Reason: "
+ e.Exception.Message);
}
else
{
DisplayMessage(
false
,
"Plan deleted"
);
}
}
private
void
DisplayMessage(
bool
isError,
string
text)
{
Label label = (isError) ?
this
.Label1 :
this
.Label2;
label.Text = text;
}
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
"ExpandCollapse"
:
foreach
(GridItem item
in
RadGrid1.MasterTableView.Items)
{
item.Expanded =
false
;
}
break
;
}
}
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
RadGrid1.EditIndexes.Add(0);
RadGrid1.Rebind();
}
}
protected
void
sdsNTA_PLAN_MASTER_Updating(
object
sender, SqlDataSourceCommandEventArgs e)
{
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
if
(item.EditFormItem.IsInEditMode)
{
e.Command.Parameters[
"@ORIGCOMPANY"
].Value = item.GetDataKeyValue(
"COMPANY"
).ToString();
e.Command.Parameters[
"@ORIGPLAN_CODE"
].Value = item.GetDataKeyValue(
"PLAN_CODE"
).ToString();
e.Command.Parameters[
"@ORIGPRODUCT_CODE"
].Value = item.GetDataKeyValue(
"PRODUCT_CODE"
).ToString();
e.Command.Parameters[
"@ORIGPLAN_LEVEL"
].Value = item.GetDataKeyValue(
"PLAN_LEVEL"
).ToString();
e.Command.Parameters[
"@ORIGSTATE_CODE"
].Value = item.GetDataKeyValue(
"STATE_CODE"
).ToString();
e.Command.Parameters[
"@ORIGEFFECTIVE_DATE"
].Value = item.GetDataKeyValue(
"EFFECTIVE_DATE"
).ToString();
e.Command.Parameters[
"@COMPANY"
].Value = ((RadComboBox)item.FindControl(
"COMPANY"
)).SelectedValue.ToString();
e.Command.Parameters[
"@PLAN_CODE"
].Value = ((RadTextBox)item.FindControl(
"PLAN_CODE"
)).Text.ToString();
e.Command.Parameters[
"@PRODUCT_CODE"
].Value = ((RadTextBox)item.FindControl(
"PRODUCT_CODE"
)).Text.ToString();
e.Command.Parameters[
"@PLAN_LEVEL"
].Value = ((RadTextBox)item.FindControl(
"PLAN_LEVEL"
)).Text.ToString();
e.Command.Parameters[
"@STATE_CODE"
].Value = ((RadComboBox)item.FindControl(
"STATE_CODE"
)).SelectedValue.ToString();
e.Command.Parameters[
"@EFFECTIVE_DATE"
].Value = ((RadDatePicker)item.EditFormItem.FindControl(
"EFFECTIVE_DATE"
)).SelectedDate.ToString();
e.Command.Parameters[
"@TERMINATION_DATE"
].Value = ((RadDatePicker)item.FindControl(
"TERMINATION_DATE"
)).SelectedDate.ToString();
e.Command.Parameters[
"@PLAN_TYPE"
].Value = ((RadComboBox)item.FindControl(
"PLAN_TYPE"
)).SelectedValue.ToString();
e.Command.Parameters[
"@COVERAGE_TYPE"
].Value = ((RadTextBox)item.FindControl(
"COVERAGE_TYPE"
)).Text.ToString();
e.Command.Parameters[
"@COVERAGE_CODE"
].Value = ((RadTextBox)item.FindControl(
"COVERAGE_CODE"
)).Text.ToString();
e.Command.Parameters[
"@LINE_OF_BUSINESS"
].Value = ((RadTextBox)item.FindControl(
"LINE_OF_BUSINESS"
)).Text.ToString();
e.Command.Parameters[
"@SPECIFIC_FORM"
].Value = ((RadTextBox)item.FindControl(
"SPECIFIC_FORM"
)).Text.ToString();
e.Command.Parameters[
"@PLAN_CODE_DESCR"
].Value = ((RadTextBox)item.FindControl(
"PLAN_CODE_DESCR"
)).Text.ToString();
e.Command.Parameters[
"@GENERIC_FORM_DESCR"
].Value = ((RadTextBox)item.FindControl(
"GENERIC_FORM_DESCR"
)).Text.ToString();
e.Command.Parameters[
"@SCHEDULE_PAGE_DESCR"
].Value = ((RadTextBox)item.FindControl(
"SCHEDULE_PAGE_DESCR"
)).Text.ToString();
e.Command.Parameters[
"@PLAN_CODE_ABRV_DESCR"
].Value = ((RadTextBox)item.FindControl(
"PLAN_CODE_ABRV_DESCR"
)).Text.ToString();
if
(((RadButton)item.FindControl(
"ENDORSEMENT_EXIST"
)).Checked)
e.Command.Parameters[
"@ENDORSEMENT_EXIST"
].Value =
"Y"
;
else
e.Command.Parameters[
"@ENDORSEMENT_EXIST"
].Value =
"N"
;
if
(((RadButton)item.FindControl(
"SOLD_RES_STATE_ONLY"
)).Checked)
e.Command.Parameters[
"@SOLD_RES_STATE_ONLY"
].Value =
"Y"
;
else
e.Command.Parameters[
"@SOLD_RES_STATE_ONLY"
].Value =
"N"
;
if
(((RadButton)item.FindControl(
"PRINT_SURR_COST_IDX"
)).Checked)
e.Command.Parameters[
"@PRINT_SURR_COST_IDX"
].Value =
"Y"
;
else
e.Command.Parameters[
"@PRINT_SURR_COST_IDX"
].Value =
"N"
;
if
(((RadButton)item.FindControl(
"EXT_BENF_STATE_SPEC"
)).Checked)
e.Command.Parameters[
"@EXT_BENF_STATE_SPEC"
].Value =
"Y"
;
else
e.Command.Parameters[
"@EXT_BENF_STATE_SPEC"
].Value =
"N"
;
if
(((RadButton)item.FindControl(
"PRINT_POLICY_FEE"
)).Checked)
e.Command.Parameters[
"@PRINT_POLICY_FEE"
].Value =
"Y"
;
else
e.Command.Parameters[
"@PRINT_POLICY_FEE"
].Value =
"N"
;
if
(((RadButton)item.FindControl(
"REQUIRED_PLAN"
)).Checked)
e.Command.Parameters[
"@REQUIRED_PLAN"
].Value =
"Y"
;
else
e.Command.Parameters[
"@REQUIRED_PLAN"
].Value =
"N"
;
e.Command.Parameters[
"@NTA_PLAN_CODE"
].Value = ((RadTextBox)item.FindControl(
"NTA_PLAN_CODE"
)).Text.ToString();
e.Command.Parameters[
"@NTA_GENERIC_FORM"
].Value = ((RadTextBox)item.FindControl(
"NTA_GENERIC_FORM"
)).Text.ToString();
e.Command.Parameters[
"@NTA_SUB_FORM"
].Value = ((RadTextBox)item.FindControl(
"NTA_SUB_FORM"
)).Text.ToString();
e.Command.Parameters[
"@RECORD_STATUS"
].Value = ((RadTextBox)item.FindControl(
"RECORD_STATUS"
)).Text.ToString();
e.Command.Parameters[
"@OPERATOR_ID"
].Value = ((RadTextBox)item.FindControl(
"OPERATOR_ID"
)).Text.ToString();
}
}
}
private
Control FindControlRecursive(Control root,
string
Id)
{
if
(root.ID == Id)
return
root;
foreach
(Control Ctrl
in
root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctrl,Id);
if
( FoundCtl !=
null
)
return
FoundCtl;
}
return
null
;
}
}
}