or
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="radCBOLookup.ascx.vb"
Inherits="HEW.radCBOLookup" %>
<
telerik:RadComboBox
ID
=
"radCBOLookup"
runat
=
"server"
MarkFirstMatch
=
"true"
AllowCustomText
=
"false"
Width
=
"50px"
DropDownWidth
=
"350px"
MaxHeight
=
"300px"
NoWrap
=
"true"
HighlightTemplatedItems
=
"true"
ExpandDirection
=
"Down"
>
<
HeaderTemplate
>
<
table
style
=
"width: 100%; text-align: left; font-size: 8pt"
>
<
tr
>
<
td
style
=
"width: 20%;"
>
Code
</
td
>
<
td
style
=
"width: 80%;"
>
Description
</
td
>
</
tr
>
</
table
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
table
style
=
"width: 100%; text-align: left; font-size: 8pt"
>
<
tr
>
<
td
style
=
"width: 20%;"
>
<%#DataBinder.Eval(Container.DataItem, "Master_Type_Code")%>
</
td
>
<
td
style
=
"width: 80%;"
>
<%#DataBinder.Eval(Container.DataItem, "Master_Desc")%>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
<
EditItemTemplate
>
<
table
style
=
"width: 740; border: 0px solid White;"
>
<
tr
>
<
td
style
=
"font-weight: bold;"
>
Hostname:
</
td
>
<
td
style
=
"width: 300px"
>
<
asp:TextBox
runat
=
"server"
ID
=
"hostname"
/>
</
td
>
<
td
style
=
"font-weight: bold;"
>
Alias:
</
td
>
<
td
>
<
asp:TextBox
runat
=
"server"
ID
=
"alias"
/>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"font-weight: bold;"
>
IP adress:
</
td
>
<
td
>
<
asp:TextBox
runat
=
"server"
ID
=
"ip"
/>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
>
<
table
style
=
"width: 740; border: 0px solid White;"
>
<
tr
>
<
td
style
=
"font-weight: bold;"
>
Description:
</
td
>
</
tr
>
<
tr
>
<
td
>
<
telerik:RadEditor
runat
=
"server"
ID
=
"telerikDesription"
ToolsFile
=
"/telerikEditorToolsTiny.xml"
Height
=
"250"
>
<
Modules
>
</
Modules
>
</
telerik:RadEditor
>
</
td
>
</
tr
>
<
tr
>
<
td
style
=
"font-weight: bold;"
>
Comments (Private field for FC):
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:TextBox
runat
=
"server"
ID
=
"comments"
/>
</
td
>
</
tr
>
</
table
>
</
EditItemTemplate
>
<
div
id
=
"frm-voucher"
>
<
asp:HiddenField
ID
=
"OfferCourseName"
runat
=
"server"
Value
=
"ITIL Training Voucher"
/>
<
asp:RadioButton
ID
=
"optVoucher"
class
=
"optVoucher"
OnCheckedChanged
=
"EnquiryTypeChanged"
AutoPostBack
=
"True"
GroupName
=
"EnquiryType"
Text
=
"Download voucher"
runat
=
"server"
/>
<
asp:Panel
ID
=
"pnlVoucher"
runat
=
"server"
Visible
=
"false"
CssClass
=
"frm-voucher"
>
<
p
>To download your voucher, please fill in your details below:</
p
>
<
div
class
=
"line"
>
<
label
>Name <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"vchName"
Width
=
"400"
ValidationGroup
=
"vchFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Company </
label
>
<
asp:TextBox
ID
=
"vchCompany"
Width
=
"400"
ValidationGroup
=
"vchFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Email <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"vchEmail"
Width
=
"400"
ValidationGroup
=
"vchFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Telephone <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"vchTelephone"
Width
=
"400"
ValidationGroup
=
"vchFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Enquiry details </
label
>
<
asp:TextBox
ID
=
"vchEnquiry"
Width
=
"400"
Height
=
"70"
TextMode
=
"MultiLine"
ValidationGroup
=
"vchFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"linebtn"
>
<
asp:ImageButton
ID
=
"vchBtnSubmit"
ImageUrl
=
"/images/btn-submit-yellow.gif"
ValidationGroup
=
"vchFrm"
runat
=
"server"
/>
<
p
>Fields marked with <
span
class
=
"req"
>*</
span
> are mandatory.</
p
>
</
div
>
</
asp:Panel
>
<
asp:Panel
ID
=
"pnlVoucherThanks"
runat
=
"server"
Visible
=
"false"
CssClass
=
"frm-voucher"
>
<
p
>Thank you for downloading your voucher. It will be sent to you by email shortly.</
p
>
</
asp:Panel
>
<
asp:RadioButton
ID
=
"optGeneral"
class
=
"optGeneral"
OnCheckedChanged
=
"EnquiryTypeChanged"
AutoPostBack
=
"True"
GroupName
=
"EnquiryType"
Text
=
"Make a general enquiry"
runat
=
"server"
/>
<
asp:Panel
ID
=
"pnlGeneral"
runat
=
"server"
Visible
=
"false"
CssClass
=
"frm-general"
>
<
p
>To download your voucher, please fill in your details below:</
p
>
<
div
class
=
"line"
>
<
label
>Name <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"genName"
Width
=
"400"
ValidationGroup
=
"genFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Company </
label
>
<
asp:TextBox
ID
=
"genCompany"
Width
=
"400"
ValidationGroup
=
"genFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Email <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"genEmail"
Width
=
"400"
ValidationGroup
=
"genFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Telephone <
span
class
=
"req"
>*</
span
></
label
>
<
asp:TextBox
ID
=
"genTelephone"
Width
=
"400"
ValidationGroup
=
"genFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"line"
>
<
label
>Enquiry details </
label
>
<
asp:TextBox
ID
=
"genEnquiry"
Width
=
"400"
Height
=
"70"
TextMode
=
"MultiLine"
ValidationGroup
=
"genFrm"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"linebtn"
>
<
asp:ImageButton
ID
=
"genBtnSubmit"
ImageUrl
=
"/images/btn-submit-yellow.gif"
ValidationGroup
=
"genFrm"
runat
=
"server"
/>
<
p
>Fields marked with <
span
class
=
"req"
>*</
span
> are mandatory.</
p
>
</
div
>
</
asp:Panel
>
<
asp:Panel
ID
=
"pnlGeneralThanks"
runat
=
"server"
Visible
=
"false"
CssClass
=
"frm-general"
>
<
p
>Thank you for making your enquiry. We will reply to you shortly.</
p
>
</
asp:Panel
>
</
div
>
<
p
>This rate applies to 5 day scheduled courses only and cannot be used in conjunction with other offers. All courses subject to availability.</
p
>
</
div
>
<telerik:RadInputManager ID=
"RadInputManager1"
runat=
"server"
>
<telerik:TextBoxSetting Validation-ValidationGroup=
"genFrm"
BehaviorID=
"genTxtBxBhv"
EmptyMessage=
"Required Field"
Validation-IsRequired=
"true"
>
<TargetControls>
<telerik:TargetInput ControlID=
"genName"
/>
<telerik:TargetInput ControlID=
"genEmail"
/>
<telerik:TargetInput ControlID=
"genTelephone"
/>
</TargetControls>
</telerik:TextBoxSetting>
<telerik:TextBoxSetting Validation-ValidationGroup=
"genFrm"
BehaviorID=
"genTxtBxBhv2"
Validation-IsRequired=
"false"
>
<TargetControls>
<telerik:TargetInput ControlID=
"genCompany"
/>
<telerik:TargetInput ControlID=
"genEnquiry"
/>
</TargetControls>
</telerik:TextBoxSetting>
<telerik:TextBoxSetting Validation-ValidationGroup=
"vchFrm"
BehaviorID=
"vchTxtBxBhv"
EmptyMessage=
"Required Field"
Validation-IsRequired=
"true"
>
<TargetControls>
<telerik:TargetInput ControlID=
"vchName"
/>
<telerik:TargetInput ControlID=
"vchEmail"
/>
<telerik:TargetInput ControlID=
"vchTelephone"
/>
</TargetControls>
</telerik:TextBoxSetting>
<telerik:TextBoxSetting Validation-ValidationGroup=
"vchFrm"
BehaviorID=
"vchTxtBxBhv2"
Validation-IsRequired=
"false"
>
<TargetControls>
<telerik:TargetInput ControlID=
"vchCompany"
/>
<telerik:TargetInput ControlID=
"vchEnquiry"
/>
</TargetControls>
</telerik:TextBoxSetting>
</telerik:RadInputManager>
Dim
AjaxManager
As
RadAjaxManager =
CType
(
Me
.Master.FindControl(
"RadAjaxManager1"
), RadAjaxManager)
Dim
RadAjaxLoadingPanel1
As
RadAjaxLoadingPanel =
CType
(
Me
.Master.FindControl(
"RadAjaxLoadingPanel1"
), RadAjaxLoadingPanel)
AjaxManager.AjaxSettings.AddAjaxSetting(optVoucher, optGeneral)
AjaxManager.AjaxSettings.AddAjaxSetting(optVoucher, pnlVoucher, RadAjaxLoadingPanel1)
AjaxManager.AjaxSettings.AddAjaxSetting(optVoucher, pnlVoucherThanks)
AjaxManager.AjaxSettings.AddAjaxSetting(optVoucher, pnlGeneral)
AjaxManager.AjaxSettings.AddAjaxSetting(optVoucher, pnlGeneralThanks)
AjaxManager.AjaxSettings.AddAjaxSetting(optGeneral, optVoucher)
AjaxManager.AjaxSettings.AddAjaxSetting(optGeneral, pnlVoucher)
AjaxManager.AjaxSettings.AddAjaxSetting(optGeneral, pnlVoucherThanks)
AjaxManager.AjaxSettings.AddAjaxSetting(optGeneral, pnlGeneral, RadAjaxLoadingPanel1)
AjaxManager.AjaxSettings.AddAjaxSetting(optGeneral, pnlGeneralThanks)
AjaxManager.AjaxSettings.AddAjaxSetting(vchBtnSubmit, pnlVoucher)
AjaxManager.AjaxSettings.AddAjaxSetting(vchBtnSubmit, pnlVoucherThanks, RadAjaxLoadingPanel1)
AjaxManager.AjaxSettings.AddAjaxSetting(genBtnSubmit, pnlGeneral)
AjaxManager.AjaxSettings.AddAjaxSetting(genBtnSubmit, pnlGeneralThanks, RadAjaxLoadingPanel1)
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default_test.aspx.vb" Inherits="_Default_test" %>
<!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
>Ofertas Rittal</
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
</
telerik:RadCodeBlock
>
<
label
style
=
"font-family: Calibri; font-size: small; font-weight: 700; height: 32px;"
>Skin:</
label
>
<
telerik:RadSkinManager
ID
=
"RadSkinManager1"
Runat
=
"server"
ShowChooser
=
"True"
Skin
=
"Windows7"
>
</
telerik:RadSkinManager
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Guardar preferencias"
>
</
telerik:RadButton
>
<
telerik:RadFormDecorator
ID
=
"FormDecorator1"
runat
=
"server"
DecoratedControls
=
"all"
></
telerik:RadFormDecorator
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadTabStrip1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadMultiPage1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
<
div
>
<
br
/>
<
telerik:RadTabStrip
ID
=
"RadTabStrip1"
runat
=
"server"
MultiPageID
=
"RadMultiPage1"
Height
=
"26px"
Width
=
"500px"
SelectedIndex
=
"1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
PageViewID
=
"RadPageView1"
Text
=
"Cabecera"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
telerik:RadMultiPage
ID
=
"RadMultiPage1"
Runat
=
"server"
Height
=
"64px"
Width
=
"500px"
SelectedIndex
=
"0"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
>
<
telerik:RadPageView
ID
=
"RadPageView1"
runat
=
"server"
BorderStyle
=
"Outset"
>
<
div
class
=
"inputs"
>
<
br
/>
<
telerik:RadTextBox
ID
=
"RadTextBox5"
Runat
=
"server"
ReadOnly
=
"True"
Text
=
"Cliente:"
Width
=
"75px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
BorderColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadMaskedTextBox
ID
=
"TB_Cod_cliente"
Runat
=
"server"
Mask
=
"########"
Width
=
"60px"
AutoPostBack
=
"True"
>
</
telerik:RadMaskedTextBox
>
<
telerik:RadTextBox
ID
=
"TB_Company"
Runat
=
"server"
Width
=
"300px"
>
</
telerik:RadTextBox
>
<
br
/>
<
br
/>
<
telerik:RadTextBox
ID
=
"RadTextBox6"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
"Dirección:"
Width
=
"75px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadTextBox
ID
=
"TB_Address1"
Runat
=
"server"
Width
=
"365px"
>
</
telerik:RadTextBox
>
<
br
/>
<
telerik:RadTextBox
ID
=
"RadTextBox7"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
""
Width
=
"75px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadTextBox
ID
=
"TB_Address2"
Runat
=
"server"
Width
=
"365px"
>
</
telerik:RadTextBox
>
<
br
/>
<
br
/>
<
telerik:RadTextBox
ID
=
"RadTextBox8"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
"Cód. postal:"
Width
=
"75px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadMaskedTextBox
ID
=
"TB_Zip"
Runat
=
"server"
Mask
=
"#####"
Width
=
"35px"
>
</
telerik:RadMaskedTextBox
>
<
telerik:RadTextBox
ID
=
"RadTextBox4"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
"Población:"
Width
=
"65px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadTextBox
ID
=
"TB_City"
Runat
=
"server"
Width
=
"240px"
>
</
telerik:RadTextBox
>
<
br
/>
<
br
/>
<
telerik:RadTextBox
ID
=
"RadTextBox10"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
"Provincia:"
Width
=
"75px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadComboBox
ID
=
"DD_State"
runat
=
"server"
DataSourceID
=
"Provincias"
DataTextField
=
"descripcion"
DataValueField
=
"descripcion"
>
</
telerik:RadComboBox
>
<
telerik:RadTextBox
ID
=
"RadTextBox17"
Runat
=
"server"
ReadOnly
=
"True"
style
=
"font-family: Calibri; font-weight: 700"
Text
=
"Contacto:"
Width
=
"70px"
Font-Bold
=
"True"
Font-Names
=
"Calibri"
Font-Size
=
"Small"
BorderWidth
=
"0px"
BackColor
=
"Transparent"
TabIndex
=
"-1"
>
</
telerik:RadTextBox
>
<
telerik:RadComboBox
ID
=
"DD_Contacto"
runat
=
"server"
AutoPostBack
=
"True"
>
</
telerik:RadComboBox
>
<
br
/>
<
br
/>
<
hr
width
=
"490px"
/>
<
br
/>
</
div
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
<
asp:SqlDataSource
ID
=
"Provincias"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:OfflineEDConnectionString %>"
SelectCommand="SELECT UPPER([descripcion]) AS descripcion FROM [Provincias_Lov_Informes] ORDER BY [descripcion]">
</
asp:SqlDataSource
>
</
div
>
</
form
>
</
body
>
</
html
>
Imports
Telerik.Web.UI
Imports
System.Data.SqlClient
Imports
System.Data
Partial
Class
_Default_test
Inherits
System.Web.UI.Page
Protected
Sub
Page_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
If
Not
IsPostBack
Then
retreive_preferences()
End
If
End
Sub
Protected
Sub
TB_Cod_cliente_TextChanged(sender
As
Object
, e
As
System.EventArgs)
Handles
TB_Cod_cliente.TextChanged
load_company_data(TB_Cod_cliente.Text)
End
Sub
Protected
Sub
load_company_data(
ByVal
cod_cli
As
String
)
If
cod_cli.Length > 0
Then
RadTabStrip1.SelectedIndex = 0
RadMultiPage1.SelectedIndex = 0
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfflineEDConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"SELECT company_name,address_1,address_2,zip,city,State_ from company where cod_cliente=@cod_cliente"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
codclienteParam
As
New
SqlParameter(
"@cod_cliente"
, cod_cli)
cmd.Parameters.Add(codclienteParam)
Dim
found
As
Boolean
=
False
Dim
reader
As
SqlDataReader
Dim
previousConnectionState
As
ConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
reader = cmd.ExecuteReader()
Using reader
While
reader.Read
' Process SprocResults datareader here.
TB_Company.Text = reader.GetValue(0).ToString
TB_Address1.Text = reader.GetValue(1).ToString
TB_Address2.Text = reader.GetValue(2).ToString
TB_Zip.Text = reader.GetValue(3).ToString
TB_City.Text = reader.GetValue(4).ToString
DD_State.SelectedValue = reader.GetValue(5).ToString
found =
True
End
While
End
Using
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
If
found =
False
Then
DD_Contacto.DataSource = CreateDataSource(cod_cli)
DD_Contacto.DataTextField =
"nombre_completo"
DD_Contacto.DataValueField =
"contact_id_text"
DD_Contacto.DataBind()
End
If
End
If
End
Sub
Function
CreateDataSource(
ByVal
cod_cliente
As
String
)
As
ICollection
Dim
dt
As
New
DataTable
Dim
dr
As
DataRow
dt.Columns.Add(
New
DataColumn(
"contact_id_text"
,
GetType
(
String
)))
dt.Columns.Add(
New
DataColumn(
"nombre_completo"
,
GetType
(
String
)))
dr = dt.NewRow()
dr(0) =
"-1"
dr(1) =
""
dt.Rows.Add(dr)
dr = dt.NewRow()
dr(0) =
"0"
dr(1) =
"_Nuevo registro_"
dt.Rows.Add(dr)
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfflineEDConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"SELECT contact_id_text,full_name from contact where cod_cliente=@cod_cliente"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
codclienteParam
As
New
SqlParameter(
"@cod_cliente"
, cod_cliente)
cmd.Parameters.Add(codclienteParam)
Dim
found
As
Boolean
=
False
Dim
reader
As
SqlDataReader
Dim
previousConnectionState
As
ConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
reader = cmd.ExecuteReader()
Using reader
While
reader.Read
' Process SprocResults datareader here.
dr = dt.NewRow()
dr(0) = reader.GetValue(0).ToString
dr(1) = reader.GetValue(1).ToString
Try
dt.Rows.Add(dr)
Catch
ex
As
Exception
End
Try
End
While
End
Using
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
Dim
dv
As
New
DataView(dt)
dv.Sort =
"nombre_completo"
Return
dv
End
Function
Protected
Sub
RadButton1_Click(sender
As
Object
, e
As
System.EventArgs)
Handles
RadButton1.Click
Dim
usuario
As
String
= Context.Request.ServerVariables(
"AUTH_USER"
)
If
usuario.Split(
"\"
).Count > 1
Then
usuario = usuario.Split(
"\"
)(1)
End
If
If
usuario.Length > 0
Then
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfertasConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"SELECT count(*) from Preferencias where usuario=@usuario"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
userParam
As
New
SqlParameter(
"@usuario"
, usuario)
cmd.Parameters.Add(userParam)
Dim
found
As
Integer
= 0
Dim
reader
As
SqlDataReader
Dim
previousConnectionState
As
ConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
reader = cmd.ExecuteReader()
Using reader
While
reader.Read
' Process SprocResults datareader here.
found = reader.GetValue(0).ToString
End
While
End
Using
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
If
found = 0
Then
insert_preferences(usuario,
"skin"
, RadSkinManager1.Skin)
Else
update_preferences(usuario,
"skin"
, RadSkinManager1.Skin)
End
If
End
If
End
Sub
Protected
Sub
update_preferences(
ByVal
username
As
String
,
ByVal
field
As
String
,
ByVal
value
As
String
)
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfertasConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"update preferencias set "
+ field +
"=@value where usuario=@usuario"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
valueParam
As
New
SqlParameter(
"@value"
, value)
cmd.Parameters.Add(valueParam)
Dim
userParam
As
New
SqlParameter(
"@usuario"
, username)
cmd.Parameters.Add(userParam)
Dim
rowCount
As
Integer
Dim
previousConnectionState
As
ConnectionState
previousConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
rowCount = cmd.ExecuteNonQuery()
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
If
rowCount = 0
Then
RadWindowManager1.RadAlert(
"Error al guardar las preferencias"
, 330, 100,
"Error!"
,
"alertCallBackFn"
)
Else
RadWindowManager1.RadAlert(
"Preferencias guardadas correctamente"
, 330, 100,
"Ok"
,
"alertCallBackFn"
)
End
If
End
Sub
Protected
Sub
insert_preferences(
ByVal
username
As
String
,
ByVal
field
As
String
,
ByVal
value
As
String
)
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfertasConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"insert into preferencias (usuario,"
+ field +
") values (@usuario,@value)"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
valueParam
As
New
SqlParameter(
"@value"
, value)
cmd.Parameters.Add(valueParam)
Dim
userParam
As
New
SqlParameter(
"@usuario"
, username)
cmd.Parameters.Add(userParam)
Dim
rowCount
As
Integer
Dim
previousConnectionState
As
ConnectionState
previousConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
rowCount = cmd.ExecuteNonQuery()
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
If
rowCount = 0
Then
RadWindowManager1.RadAlert(
"Error al guardar las preferencias"
, 330, 100,
"Error!"
,
"alertCallBackFn"
)
Else
RadWindowManager1.RadAlert(
"Preferencias guardadas correctamente"
, 330, 100,
"Ok"
,
"alertCallBackFn"
)
End
If
End
Sub
Protected
Sub
retreive_preferences()
Dim
usuario
As
String
= Context.Request.ServerVariables(
"AUTH_USER"
)
If
usuario.Split(
"\"
).Count > 1
Then
usuario = usuario.Split(
"\"
)(1)
End
If
If
usuario.Length > 0
Then
Dim
conn
As
New
SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings(
"OfertasConnectionString"
).ConnectionString
Dim
cmd
As
New
SqlCommand
cmd.CommandType = CommandType.Text
cmd.CommandText =
"SELECT skin from Preferencias where usuario=@usuario"
cmd.Connection = conn
' Create a SqlParameter for each parameter in the stored procedure.
Dim
userParam
As
New
SqlParameter(
"@usuario"
, usuario)
cmd.Parameters.Add(userParam)
Dim
skin
As
String
=
""
Dim
reader
As
SqlDataReader
Dim
previousConnectionState
As
ConnectionState = conn.State
Try
If
conn.State = ConnectionState.Closed
Then
conn.Open()
End
If
reader = cmd.ExecuteReader()
Using reader
While
reader.Read
' Process SprocResults datareader here.
skin = reader.GetValue(0).ToString
End
While
End
Using
Finally
If
previousConnectionState = ConnectionState.Closed
Then
conn.Close()
End
If
End
Try
If
skin.Length > 0
Then
RadSkinManager1.Skin = skin
End
If
End
If
End
Sub
End
Class
Hello Telerik Team,
I want to use the schedulder in a such that all the days of the month comes column wise and rooms in the row wise
I have attached an excel file which shows my requirement.
Is there any way to achive this?
Thanks in advance.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<!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
></
title
>
<
link
href
=
"Styles/StyleSheet1.css"
type
=
"text/css"
rel
=
"Stylesheet"
/>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
<
script
type
=
"text/javascript"
>
function ensureSomethingSelected(source, eventargs) {
var dropDown = $find("<%=rcb1.ClientID %>");
if (dropDown.get_text() != null && dropDown.get_text() != dropDown.get_emptyMessage()) {
args.IsValid = true;
}
}
</
script
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
id
=
"cont1"
>
<
h1
>SouthWinds Mfg.</
h1
>
<
div
style
=
"overflow:auto;"
>
<
asp:Label
ID
=
"lblMessage"
runat
=
"server"
Text
=
""
></
asp:Label
>
</
div
>
<
hr
/>
<
div
id
=
"navButtons"
>
<
div
style
=
"float:left; width:100px;"
>
<
asp:Button
ID
=
"btnBack"
runat
=
"server"
Text
=
"Back"
CausesValidation
=
"false"
OnClick
=
"btnBack_Click"
/>
</
div
>
<
div
style
=
"float:right;width:100px;"
>
<
asp:Button
ID
=
"btnForward"
runat
=
"server"
Text
=
"Forward"
CausesValidation
=
"false"
OnClick
=
"btnForward_Click"
/>
</
div
>
</
div
>
<
hr
/>
<
div
class
=
"class1"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"ID"
CssClass
=
"formLabels"
></
asp:Label
>
<
asp:Label
ID
=
"lblID"
runat
=
"server"
></
asp:Label
>
</
div
>
<
div
class
=
"class1"
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
AssociatedControlID
=
"txt2"
Text
=
"MFG NO"
CssClass
=
"formLabels"
></
asp:Label
>
<
asp:TextBox
ID
=
"txt2"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"class1"
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
AssociatedControlID
=
"txt3"
Text
=
"PART NO"
CssClass
=
"formLabels"
></
asp:Label
> <
asp:TextBox
ID
=
"txt3"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"class1"
>
<
asp:Label
ID
=
"Label4"
runat
=
"server"
AssociatedControlID
=
"txt4"
Text
=
"DESCR"
CssClass
=
"formLabels"
></
asp:Label
>
<
asp:TextBox
ID
=
"txt4"
runat
=
"server"
></
asp:TextBox
>
</
div
>
<
div
class
=
"class1"
>If you do not see your parent, please type it in:</
div
>
<
div
id
=
"cont0"
>
<
telerik:RadAjaxPanel
ID
=
"rap1"
runat
=
"server"
>
<
telerik:RadComboBox
ID
=
"rcb1"
runat
=
"server"
ClientIDMode
=
"Static"
EnableLoadOnDemand
=
"true"
EnableVirtualScrolling
=
"true"
ShowMoreResultsBox
=
"true"
OnItemsRequested
=
"rcb1_ItemsRequested"
Width
=
"200"
>
</
telerik:RadComboBox
>
</
telerik:RadAjaxPanel
>
</
div
>
<
div
style
=
"float:none;"
>
<
asp:CustomValidator
ID
=
"cv1"
runat
=
"server"
ValidateEmptyText
=
"true"
ControlToValidate
=
"rcb1"
EnableClientScript
=
"true"
ClientValidationFunction
=
"ensureSomethingSelected"
ErrorMessage
=
"You must select an item!"
OnServerValidate
=
"rcb1_ServerValidate"
>
</
asp:CustomValidator
>
</
div
>
<
div
class
=
"buttonBar"
>
<
asp:Button
ID
=
"btn1"
runat
=
"server"
Text
=
"Save"
OnClick
=
"btn1_Click"
/>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Data.SqlClient;
using
System.Configuration;
using
System.Web.Security;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
public
partial
class
Default : System.Web.UI.Page
{
private
const
int
ItemsPerRequest = 10;
protected
void
Page_Init(
object
sender, EventArgs e)
{
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
LoadPart();
}
//***RESET INFORMATION MESSAGES
lblMessage.Text =
""
;
}
protected
void
btn1_Click(
object
sender, EventArgs e)
{
if
(IsValid)
{
}
}
protected
void
LoadPart()
{
SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"widConn"
].ToString());
SqlCommand cmd =
new
SqlCommand(
"SELECT * FROM PARTS"
, con);
DataSet ds =
new
DataSet(
"dsParts"
);
DataTable dt =
new
DataTable(
"dtParts"
);
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
int
currIndex = 0;
ViewState[
"currIndex"
] = currIndex;
using
(con)
{
con.Open();
da.Fill(ds);
dt = ds.Tables[0];
ViewState[
"dtParts"
] = dt;
ViewState[
"rowCount"
] = dt.Rows.Count;
lblID.Text = Convert.ToString(dt.Rows[currIndex][0]);
txt2.Text = (
string
)dt.Rows[currIndex][1];
txt3.Text = (
string
)dt.Rows[currIndex][2];
txt4.Text = Convert.ToString(dt.Rows[currIndex][3]);
}
}
protected
void
rcb1_ServerValidate(
object
source, ServerValidateEventArgs args)
{
}
protected
void
rcb1_ItemsRequested(
object
sender, RadComboBoxItemsRequestedEventArgs e)
{
DataTable data = GetData(e.Text);
int
itemOffset = e.NumberOfItems;
int
endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);
e.EndOfItems = endOffset == data.Rows.Count;
for
(
int
i = itemOffset; i < endOffset; i++)
{
rcb1.Items.Add(
new
RadComboBoxItem(data.Rows[i][
"FULLY_QUALIFIED_PART_NO"
].ToString(), data.Rows[i][
"ID"
].ToString()));
}
e.Message = GetStatusMessage(endOffset, data.Rows.Count);
}
private
static
DataTable GetData(
string
text)
{
SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"widConn"
].ConnectionString);
SqlDataAdapter adapter =
new
SqlDataAdapter(
"usp_GetMfgPartsScrolling"
, con);
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
adapter.SelectCommand.Parameters.AddWithValue(
"@text"
, text);
DataTable data =
new
DataTable();
using
(con)
{
con.Open();
adapter.Fill(data);
}
return
data;
}
private
static
string
GetStatusMessage(
int
offset,
int
total)
{
if
(total <= 0)
return
"No matches"
;
return
String.Format(
"Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>"
, offset, total);
}
protected
void
btnForward_Click(
object
sender, EventArgs e)
{
DataTable dt = (DataTable)ViewState[
"dtParts"
];
int
currIndex = (Int32)ViewState[
"currIndex"
];
int
rowCount = (Int32)ViewState[
"rowCount"
];
if
((currIndex + 1) < rowCount)
{
lblID.Text = Convert.ToString(dt.Rows[currIndex + 1][0]);
txt2.Text = (
string
)dt.Rows[currIndex + 1][1];
txt3.Text = (
string
)dt.Rows[currIndex + 1][2];
ViewState[
"currIndex"
] = currIndex + 1;
}
else
{
lblMessage.Text =
"You are at the end of the recordset"
;
}
}
protected
void
btnBack_Click(
object
sender, EventArgs e)
{
DataTable dt = (DataTable)ViewState[
"dtParts"
];
int
currIndex = (Int32)ViewState[
"currIndex"
];
if
(currIndex - 1 >= 0)
{
lblID.Text = Convert.ToString(dt.Rows[currIndex - 1][0]);
txt2.Text = (
string
)dt.Rows[currIndex - 1][1];
txt3.Text = (
string
)dt.Rows[currIndex - 1][2];
ViewState[
"currIndex"
] = currIndex - 1;
}
else
{
lblMessage.Text =
"You are at the beginning of the recordset"
;
}
}
}