I have a page in development that is basically a large hierarchical radgrid. What is happening is any sort of AJAX request is causing the page to scroll to the top. The loading panel is also not working. Please help!
Also, please note that there is a script manager inside the "DashboardSelector" user control.
ASP:
Code Behind:
Also, please note that there is a script manager inside the "DashboardSelector" user control.
ASP:
<%@ Page Title="" Language="VB" MasterPageFile="~/All/Site.master" EnableEventValidation="false" AutoEventWireup="false" CodeFile="Orders.aspx.vb" Inherits="Management_Dashboard_AllOrders" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register src="../../Controls/DashboardSelector.ascx" tagname="DashboardSelector" tagprefix="uc1" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
Runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
Runat
=
"Server"
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
Runat
=
"server"
MinDisplayTime
=
"5"
Skin
=
"Default"
Transparency
=
"20"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager"
runat
=
"server"
DefaultLoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"OrdersGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"OrdersGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
uc1:DashboardSelector
ID
=
"DashboardSelector1"
runat
=
"server"
/>
<
h4
>New Orders</
h4
>
<
telerik:RadButton
ID
=
"btnExportToExcel"
runat
=
"server"
Text
=
"Export to Excel"
>
</
telerik:RadButton
>
<
telerik:RadGrid
ID
=
"OrdersGrid"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
DataSourceID
=
"GPOrderHeadersDataSource"
GridLines
=
"None"
Skin
=
"Telerik"
AllowSorting
=
"True"
ShowGroupPanel
=
"True"
>
<
ExportSettings
FileName
=
"OrdersExport"
IgnorePaging
=
"True"
ExportOnlyData
=
"True"
>
<
Excel
Format
=
"ExcelML"
/>
<
Excel
Format
=
"ExcelML"
></
Excel
>
</
ExportSettings
>
<
ClientSettings
AllowColumnsReorder
=
"True"
AllowDragToGroup
=
"True"
ReorderColumnsOnClient
=
"True"
>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataKeyNames
=
"SOPNUMBE"
DataSourceID
=
"GPOrderHeadersDataSource"
PageSize
=
"50"
>
<
DetailTables
>
<
telerik:GridTableView
runat
=
"server"
DataKeyNames
=
"SOPNUMBE"
AllowFilteringByColumn
=
"False"
AllowPaging
=
"False"
AutoGenerateColumns
=
"False"
DataSourceID
=
"DetailsDataSource"
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"SOPNUMBE"
MasterKeyField
=
"SOPNUMBE"
/>
</
ParentTableRelation
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"SOPNUMBE"
HeaderText
=
"SOPNUMBE"
SortExpression
=
"SOPNUMBE"
UniqueName
=
"SOPNUMBE"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ITMSHNAM"
HeaderText
=
"ITMSHNAM"
SortExpression
=
"ITMSHNAM"
UniqueName
=
"ITMSHNAM"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ITEMDESC"
HeaderText
=
"ITEMDESC"
SortExpression
=
"ITEMDESC"
UniqueName
=
"ITEMDESC"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"STATUS"
HeaderText
=
"STATUS"
SortExpression
=
"STATUS"
UniqueName
=
"STATUS"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Qty"
DataFormatString
=
"{0:0}"
DataType
=
"System.Double"
HeaderText
=
"Qty"
SortExpression
=
"Qty"
UniqueName
=
"Qty"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ATYALLOC"
DataFormatString
=
"{0:0}"
DataType
=
"System.Double"
HeaderText
=
"ATYALLOC"
SortExpression
=
"ATYALLOC"
UniqueName
=
"ATYALLOC"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"QTYFULFI"
DataFormatString
=
"{0:0}"
DataType
=
"System.Double"
HeaderText
=
"QTYFULFI"
SortExpression
=
"QTYFULFI"
UniqueName
=
"QTYFULFI"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"LOCNCODE"
HeaderText
=
"LOCNCODE"
SortExpression
=
"LOCNCODE"
UniqueName
=
"LOCNCODE"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
ShowAddNewRecordButton
=
"False"
ShowExportToExcelButton
=
"True"
ShowExportToPdfButton
=
"True"
></
CommandItemSettings
>
<
ExpandCollapseColumn
Visible
=
"True"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"Color"
AllowFiltering
=
"False"
Groupable
=
"False"
>
<
ItemTemplate
>
<
telerik:RadComboBox
ID
=
"cboColorChanger"
Runat
=
"server"
AutoPostBack
=
"True"
DataTextField
=
"Color"
DataValueField
=
"SOPNUMBE"
onselectedindexchanged
=
"cboColorChanger0_SelectedIndexChanged"
SelectedValue='<%# GetColor() %>' Skin="Telerik" Width="65px" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Owner
=
"cboColorChanger"
Text
=
"None"
Value
=
"None"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"Red"
ForeColor
=
"Red"
Owner
=
"cboColorChanger"
Text
=
"Red"
Value
=
"Red"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"#FF8000"
ForeColor
=
"#FF8000"
Owner
=
"cboColorChanger"
Text
=
"Orange"
Value
=
"Orange"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"Yellow"
ForeColor
=
"Yellow"
Owner
=
"cboColorChanger"
Text
=
"Yellow"
Value
=
"Yellow"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"Lime"
ForeColor
=
"Lime"
Owner
=
"cboColorChanger"
Text
=
"Green"
Value
=
"Green"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"Cyan"
ForeColor
=
"Cyan"
Owner
=
"cboColorChanger"
Text
=
"Blue"
Value
=
"Blue"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
BackColor
=
"Fuchsia"
ForeColor
=
"Fuchsia"
Owner
=
"cboColorChanger"
Text
=
"Pink"
Value
=
"Pink"
/>
</
Items
>
</
telerik:RadComboBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"CUSTNMBR"
HeaderText
=
"CUSTNMBR"
ReadOnly
=
"True"
SortExpression
=
"CUSTNMBR"
UniqueName
=
"CUSTNMBR"
HeaderTooltip
=
"Customer Number"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CUSTNAME"
HeaderText
=
"CUSTNAME"
ReadOnly
=
"True"
SortExpression
=
"CUSTNAME"
UniqueName
=
"CUSTNAME"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SOPNUMBE"
HeaderText
=
"SOP"
ReadOnly
=
"True"
SortExpression
=
"SOPNUMBE"
UniqueName
=
"SOPNUMBE"
HeaderTooltip
=
"SOP Number"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PO"
HeaderText
=
"PO"
ReadOnly
=
"True"
SortExpression
=
"PO"
UniqueName
=
"PO"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ReqShipDate"
DataFormatString
=
"{0:MM/dd/yyyy}"
HeaderText
=
"RSD"
ReadOnly
=
"True"
SortExpression
=
"ReqShipDate"
UniqueName
=
"ReqShipDate"
HeaderTooltip
=
"Required Ship Date"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ORDRDATE"
DataFormatString
=
"{0:MM/dd/yyyy}"
HeaderText
=
"OD"
ReadOnly
=
"True"
SortExpression
=
"ORDRDATE"
UniqueName
=
"ORDRDATE"
HeaderTooltip
=
"Order Date"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CITY"
HeaderText
=
"CITY"
ReadOnly
=
"True"
SortExpression
=
"CITY"
UniqueName
=
"CITY"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"STATE"
HeaderText
=
"ST"
ReadOnly
=
"True"
SortExpression
=
"STATE"
UniqueName
=
"STATE"
HeaderTooltip
=
"State"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DOCID"
HeaderText
=
"DOCID"
ReadOnly
=
"True"
SortExpression
=
"DOCID"
UniqueName
=
"DOCID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OREMSUBT"
DataFormatString
=
"{0:C}"
HeaderText
=
"OREMSUBT"
ReadOnly
=
"True"
SortExpression
=
"OREMSUBT"
UniqueName
=
"OREMSUBT"
HeaderTooltip
=
"Original Remaining Subtotal"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"NumLines"
DataType
=
"System.Int32"
HeaderText
=
"NL"
ReadOnly
=
"True"
SortExpression
=
"NumLines"
UniqueName
=
"NumLines"
HeaderTooltip
=
"Number of Lines"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
AllowFiltering
=
"False"
Groupable
=
"False"
HeaderText
=
"Notes"
Reorderable
=
"False"
UniqueName
=
"Notes"
Visible
=
"False"
>
<%--<
ItemTemplate
>
<
table
style
=
"border-width: 0px; border-style: none; text-align: center;"
>
<
tr
><
td
>
<
telerik:RadTextBox
ID
=
"txtNotes"
Runat
=
"server"
Height
=
"50px"
Skin
=
"Telerik"
Text="<%# GetNotes() %>" TextMode="MultiLine" Width="250px">
</
telerik:RadTextBox
>
</
td
></
tr
>
<
tr
><
td
>
<
telerik:RadButton
ID
=
"btnUpdateNotes"
runat
=
"server"
Skin
=
"Telerik"
Text
=
"Update Notes"
onclick
=
"btnUpdateNotes_Click"
>
</
telerik:RadButton
>
</
td
></
tr
>
</
table
>
</
ItemTemplate
>--%>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
AllowFiltering
=
"False"
HeaderText
=
"Note"
Resizable
=
"False"
UniqueName
=
"Notes Icon"
>
<
ItemTemplate
>
<
asp:Panel
ID
=
"NotesPanel"
Visible
=
"true"
runat
=
"server"
>
<
asp:ImageButton
ID
=
"imgNote"
runat
=
"server"
AlternateText="<%# GetNotes() %>"
ImageUrl="<%# NoteImage() %>" onclick="ImageButton1_Click"
ToolTip="<%# GetNotes() %>" />
</
asp:Panel
>
<
asp:Panel
ID
=
"EditNotesPanel"
Visible
=
"false"
runat
=
"server"
>
<
table
style
=
"border-width: 0px; border-style: none; text-align: center;"
>
<
tr
><
td
>
<
telerik:RadTextBox
ID
=
"txtNotes"
Runat
=
"server"
Height
=
"50px"
Skin
=
"Telerik"
Text="<%# GetNotes() %>" TextMode="MultiLine" Width="250px">
</
telerik:RadTextBox
>
</
td
></
tr
>
<
tr
><
td
>
<
telerik:RadButton
ID
=
"btnUpdateNotes"
runat
=
"server"
Skin
=
"Telerik"
Text
=
"Update Notes"
onclick
=
"btnUpdateNotes_Click"
>
</
telerik:RadButton
>
</
td
></
tr
>
</
table
>
</
asp:Panel
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
/>
</
MasterTableView
>
<
HeaderContextMenu
EnableImageSprites
=
"True"
CssClass
=
"GridContextMenu GridContextMenu_Default"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"GPOrderHeadersDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:OrdersConString %>" SelectCommand="SELECT RTRIM(SOP10100.CUSTNAME) AS CUSTNAME, RTRIM(SOP10100.SOPNUMBE) AS SOPNUMBE, RTRIM(SOP10100.CSTPONBR) AS PO,
(SOP10100.ReqShipDate) AS ReqShipDate, (SOP10100.ORDRDATE) AS ORDRDATE, RTRIM(SOP10100.CITY) AS CITY, RTRIM(SOP10100.STATE)
AS STATE, RTRIM(SOP10100.CUSTNMBR) AS CUSTNMBR, RTRIM(SOP10100.DOCID) AS DOCID, (SOP10100.OREMSUBT) AS OREMSUBT,
COUNT(SOP10200.ITEMNMBR) AS NumLines
FROM SOP10100 INNER JOIN
SOP10200 ON SOP10100.SOPNUMBE = SOP10200.SOPNUMBE AND SOP10100.SOPTYPE = SOP10200.SOPTYPE
WHERE (SOP10100.CUSTNMBR NOT LIKE 'WALCANA') AND (SOP10100.CUSTNMBR NOT LIKE 'WALMART') AND (SOP10100.SOPTYPE = 2) AND VOIDSTTS = 0
GROUP BY RTRIM(SOP10100.CUSTNAME), RTRIM(SOP10100.SOPNUMBE), RTRIM(SOP10100.CSTPONBR), (SOP10100.ReqShipDate), (SOP10100.ORDRDATE),
RTRIM(SOP10100.CITY), RTRIM(SOP10100.STATE), RTRIM(SOP10100.CUSTNMBR), RTRIM(SOP10100.DOCID), (SOP10100.OREMSUBT)
ORDER BY RTRIM(SOP10100.CUSTNAME)"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"DetailsDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:OrdersConString %>"
SelectCommand="SELECT RTRIM(SOP10100.SOPNUMBE) AS SOPNUMBE, RTRIM(IV00101.ITMSHNAM) AS ITMSHNAM, RTRIM(SOP10200.ITEMDESC) AS ITEMDESC, RTRIM(IV00101.USCATVLS_5) AS STATUS, ROUND(SOP10200.QTYREMAI,0) AS Qty, ROUND(SOP10200.ATYALLOC,0) AS ATYALLOC, ROUND(SOP10200.QTYFULFI,0) AS QTYFULFI, RTRIM(SOP10200.LOCNCODE) AS LOCNCODE FROM SOP10200 INNER JOIN IV00101 ON SOP10200.ITEMNMBR = IV00101.ITEMNMBR INNER JOIN SOP10100 ON SOP10200.SOPNUMBE = SOP10100.SOPNUMBE AND SOP10200.SOPTYPE = SOP10100.SOPTYPE WHERE (SOP10100.CUSTNMBR NOT LIKE 'WALCANA') AND (SOP10100.CUSTNMBR NOT LIKE 'WALMART') AND (SOP10200.SOPTYPE = 2) AND (SOP10100.VOIDSTTS = 0) AND (SOP10100.SOPNUMBE = @SOPNUMBE) ORDER BY SOPNUMBE DESC">
<
SelectParameters
>
<
asp:Parameter
Name
=
"SOPNUMBE"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"ColorsDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>"
SelectCommand="SELECT * FROM [OrdersTableRowColor]"></
asp:SqlDataSource
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
Skin
=
"Black"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"NotesWindow"
runat
=
"server"
Animation
=
"Fade"
AutoSize
=
"True"
EnableShadow
=
"True"
KeepInScreenBounds
=
"True"
Skin
=
"Telerik"
style
=
"display:none;"
VisibleStatusbar
=
"False"
DestroyOnClose
=
"True"
Overlay
=
"True"
Title
=
"Update Note"
Behavior
=
"Close"
Behaviors
=
"Close"
Modal
=
"True"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
</
asp:Content
>
Code Behind:
Imports
Telerik.Web.UI
Imports
System.Data
Imports
System.Data.SqlClient
Partial
Class
Management_Dashboard_AllOrders
Inherits
System.Web.UI.Page
Dim
conString
As
String
=
"Data Source=PDC-SQL1;Initial Catalog=Intranet;Integrated Security=True"
Dim
conn
As
SqlConnection =
New
SqlConnection(conString)
Dim
notesURL
As
String
=
"images/Note.png"
Dim
noNotesURL
As
String
=
"images/noNote.png"
Protected
Sub
RadButton1_Click(sender
As
Object
, e
As
System.EventArgs)
Handles
btnExportToExcel.Click
OrdersGrid.MasterTableView.ExportToExcel()
End
Sub
Protected
Function
GetNotes()
As
String
Dim
getTheNotes
As
SqlCommand =
New
SqlCommand(
"SELECT Notes FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
notes
As
String
=
""
Dim
s
As
String
=
""
Try
s = Eval(
"SOPNUMBE"
)
Catch
Try
s = Session(
"SOP"
)
Catch
End
Try
End
Try
Try
getTheNotes.Connection.Open()
getTheNotes.Parameters.AddWithValue(
"@sopnumbe"
, s)
notes =
If
(
TypeOf
getTheNotes.ExecuteScalar()
Is
DBNull,
""
, getTheNotes.ExecuteScalar())
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
getTheNotes.Connection.Close()
End
Try
If
notes <>
Nothing
Then
Return
notes
Else
Return
""
End
If
End
Function
Protected
Function
GetColor()
As
String
Dim
getTheColor
As
SqlCommand =
New
SqlCommand(
"SELECT color FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
col
As
String
=
""
Try
getTheColor.Connection.Open()
getTheColor.Parameters.AddWithValue(
"@sopnumbe"
, Eval(
"SOPNUMBE"
).ToString)
col = getTheColor.ExecuteScalar()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
getTheColor.Connection.Close()
End
Try
If
col <>
Nothing
Then
Return
col
Else
Return
"None"
End
If
End
Function
Protected
Sub
ColorRow(
ByVal
r
As
GridDataItem, col
As
String
)
Select
Case
col
Case
"None"
r.BackColor = Drawing.Color.Empty
Case
"Red"
r.BackColor = Drawing.Color.Red
Case
"Orange"
r.BackColor = Drawing.Color.Orange
Case
"Yellow"
r.BackColor = Drawing.Color.Yellow
Case
"Green"
r.BackColor = Drawing.Color.Lime
Case
"Blue"
r.BackColor = Drawing.Color.Cyan
Case
"Pink"
r.BackColor = Drawing.Color.Fuchsia
Case
Else
r.BackColor = Drawing.Color.Empty
End
Select
End
Sub
Protected
Sub
cboColorChanger0_SelectedIndexChanged(sender
As
Object
, e
As
Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
Dim
color
As
String
=
CType
(sender, RadComboBox).SelectedValue
Dim
r
As
GridDataItem =
CType
(sender.parent.parent, GridDataItem)
Dim
sop
As
String
= r(
"SOPNUMBE"
).Text
Dim
colorPresent
As
SqlCommand =
New
SqlCommand(
"SELECT * FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
getColor
As
SqlCommand =
New
SqlCommand(
"SELECT color FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
insertColor
As
SqlCommand =
New
SqlCommand(
"INSERT INTO [OrdersTableEX] ([SOPNUMBE],[color]) VALUES (@sopnumbe,@col)"
, conn)
Dim
updateColor
As
SqlCommand =
New
SqlCommand(
"UPDATE [OrdersTableEX] SET [color] = @col WHERE SOPNUMBE = @sopnumbe"
, conn)
colorPresent.Parameters.AddWithValue(
"@sopnumbe"
, sop)
Dim
present
As
String
=
""
Try
colorPresent.Connection.Open()
present = colorPresent.ExecuteScalar()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
colorPresent.Connection.Close()
End
Try
If
present <> sop
Then
Try
insertColor.Connection.Open()
insertColor.Parameters.AddWithValue(
"@sopnumbe"
, sop)
insertColor.Parameters.AddWithValue(
"@col"
, color)
insertColor.ExecuteNonQuery()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
insertColor.Connection.Close()
End
Try
Else
Try
updateColor.Connection.Open()
updateColor.Parameters.AddWithValue(
"@col"
, color)
updateColor.Parameters.AddWithValue(
"@sopnumbe"
, sop)
updateColor.ExecuteNonQuery()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
updateColor.Connection.Close()
End
Try
End
If
Dim
col
As
String
=
""
Try
getColor.Connection.Open()
getColor.Parameters.AddWithValue(
"@sopnumbe"
, sop)
col = getColor.ExecuteScalar()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
getColor.Connection.Close()
End
Try
ColorRow(r, col)
End
Sub
Protected
Sub
OrdersGrid_DataBound(sender
As
Object
, e
As
System.EventArgs)
Handles
OrdersGrid.DataBound
For
Each
r
As
GridDataItem
In
OrdersGrid.Items
ColorRow(r,
CType
(r(
"Color"
).FindControl(
"cboColorChanger"
), RadComboBox).SelectedValue)
Next
End
Sub
Protected
Sub
btnUpdateNotes_Click(sender
As
Object
, e
As
System.EventArgs)
Dim
notes
As
String
=
CType
(
CType
(sender.parent.parent, GridTableCell).FindControl(
"txtNotes"
), RadTextBox).Text
Dim
r
As
GridDataItem =
CType
(sender.parent.parent.parent, GridDataItem)
Dim
sop
As
String
= r(
"SOPNUMBE"
).Text
Dim
colorPresent
As
SqlCommand =
New
SqlCommand(
"SELECT * FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
getNotes
As
SqlCommand =
New
SqlCommand(
"SELECT Notes FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
insertNotes
As
SqlCommand =
New
SqlCommand(
"INSERT INTO [OrdersTableEX] ([SOPNUMBE],[Notes]) VALUES (@sopnumbe,@col)"
, conn)
Dim
updateNotes
As
SqlCommand =
New
SqlCommand(
"UPDATE [OrdersTableEX] SET [Notes] = @col WHERE SOPNUMBE = @sopnumbe"
, conn)
colorPresent.Parameters.AddWithValue(
"@sopnumbe"
, sop)
Dim
present
As
String
=
""
Try
colorPresent.Connection.Open()
present = colorPresent.ExecuteScalar()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
colorPresent.Connection.Close()
End
Try
If
present <> sop
Then
Try
insertNotes.Connection.Open()
insertNotes.Parameters.AddWithValue(
"@sopnumbe"
, sop)
insertNotes.Parameters.AddWithValue(
"@col"
, notes)
insertNotes.ExecuteNonQuery()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
insertNotes.Connection.Close()
End
Try
Else
Try
updateNotes.Connection.Open()
updateNotes.Parameters.AddWithValue(
"@col"
, notes)
updateNotes.Parameters.AddWithValue(
"@sopnumbe"
, sop)
updateNotes.ExecuteNonQuery()
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
updateNotes.Connection.Close()
End
Try
End
If
CType
(
CType
(sender.parent.parent, GridTableCell).FindControl(
"NotesPanel"
), Panel).Visible =
True
CType
(
CType
(sender.parent.parent, GridTableCell).FindControl(
"EditNotesPanel"
), Panel).Visible =
False
Session(
"SOP"
) = sop
CType
(
CType
(sender.parent.parent, GridTableCell).FindControl(
"imgNote"
), ImageButton).DataBind()
End
Sub
Protected
Function
NoteImage()
As
String
Dim
getTheNotes
As
SqlCommand =
New
SqlCommand(
"SELECT Notes FROM OrdersTableEX WHERE SOPNUMBE = @sopnumbe"
, conn)
Dim
notes
As
String
=
""
Dim
s
As
String
=
""
Try
s = Eval(
"SOPNUMBE"
)
Catch
Try
s = Session(
"SOP"
)
Catch
End
Try
End
Try
Try
getTheNotes.Connection.Open()
getTheNotes.Parameters.AddWithValue(
"@sopnumbe"
, s)
notes =
If
(
TypeOf
getTheNotes.ExecuteScalar()
Is
DBNull,
""
, getTheNotes.ExecuteScalar())
Catch
MsgBox(
"ERROR: Please contact IT"
, MsgBoxStyle.Critical,
"ERROR"
)
Finally
getTheNotes.Connection.Close()
End
Try
If
notes <>
Nothing
Then
Return
notesURL
Else
Return
noNotesURL
End
If
End
Function
Protected
Sub
ImageButton1_Click(sender
As
Object
, e
As
System.Web.UI.ImageClickEventArgs)
Dim
r
As
GridDataItem =
CType
(sender.parent.parent.parent, GridDataItem)
Dim
c
As
GridTableCell =
CType
(sender.parent.parent, GridTableCell)
CType
(c.FindControl(
"NotesPanel"
), Panel).Visible =
False
CType
(c.FindControl(
"EditNotesPanel"
), Panel).Visible =
True
'RadWindowManager1.Windows(0).NavigateUrl = "notesEditor.aspx?SOP=" + r("SOPNUMBE").Text
'RadWindowManager1.Windows(0).VisibleOnPageLoad = True
End
Sub
Protected
Sub
Page_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
If
IsPostBack
Then
RadWindowManager1.Windows(0).VisibleOnPageLoad =
False
End
If
End
Sub
End
Class