I have an ASP.Net page with a RadGrid within the RadPageLayout.
There is a RadTextBox within the RadPageLayout. A user will enter in the Serial Number into the RadTextBox and click the SCAN button which is a RadButton. Clicking on the SCAN button causes the VB.Net code-behind to a number of checks on the Serial Number entered and puts the results in a table that was bound to the RadGrid. A Rebind is done with the RadGrid to show the results and the row with the Serial Number is selected.
Once the Rebind is done and row is selected, I need the RadGrid to scroll to the selected row. I am having trouble getting that to work. I have tried what the Telerik documentation states about scrolling to selected row and did not work. I have tried using SelectedIndexChanged event with RadGrid and did not work.
Here is a portion of the code-behind for the Scan button click:
' Rebind Grid to show status of scan.rgInvntCycleReconcl.Rebind()' Select Row with Serial NumberDim gdiItem As GridDataItem = rgInvntCycleReconcl.MasterTableView.FindItemByKeyValue("SERIAL_NO", strSerialNbr)gdiItem.Selected = TrueHere is the RadGrid in ASP.Net page:
<telerik:RadGrid ID="rgInvntCycleReconcl" runat="server" GroupPanelPosition="Top" Height="246px" AutoGenerateColumns="False" AllowPaging="True" RenderMode="Auto" PageSize="2000" OnNeedDataSource="rgInvntCycleReconcl_NeedDataSource" OnSelectedIndexChanged="rgInvntCycleReconcl_SelectedIndexChanged"> <GroupingSettings CollapseAllTooltip="Collapse all groups" /> <ExportSettings IgnorePaging="True"> <Pdf AllowPrinting="False"> </Pdf> <Excel FileExtension="xlsx" Format="Xlsx" /> </ExportSettings> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" /> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView EnableViewState="true" Font-Size="Medium" DataKeyNames="SERIAL_NO"> <Columns> <telerik:GridBoundColumn DataField="SERIAL_NO" FilterControlAltText="Filter column column" HeaderText="Serial No." ReadOnly="True" UniqueName="SerialNbr"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="LOCATION" FilterControlAltText="Filter column1 column" HeaderText="Location" ReadOnly="True" UniqueName="Location"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="STATUS" FilterControlAltText="Filter column2 column" HeaderText="Status" ReadOnly="True" UniqueName="Status"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SCAN_LOC" FilterControlAltText="Filter column3 column" HeaderText="Scan Location" ReadOnly="True" UniqueName="ScanLocation"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="WEIGHT_KGS" FilterControlAltText="Filter column4 column" HeaderText="Weight KGS" ReadOnly="True" UniqueName="WeightKGS"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevNumericAndAdvanced" /></telerik:RadGrid>Please help!
Sincerely,
Keith Jackson
6 Answers, 1 is accepted
For achieving the desired result you could get reference to the selected item when the page loads and manually change the scroll position. The following code should work for most cases:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function pageLoad() { var grid = $find("<%=RadGrid1.ClientID%>"); var master = grid.get_masterTableView(); var activeItemID = document.getElementById("<%=ActiveItemID.ClientID%>").value; if (master.get_selectedItems().length > 0) { var item = master.get_selectedItems()[0]; var rowElement = item.get_element(); var offset = rowElement.offsetTop; setScroll(grid, offset); } } function setScroll(grid, scrollTop) { var dataDiv = $telerik.findElement(grid.get_element(), grid.get_id() + "_GridData"); dataDiv.scrollTop = scrollTop; } </script></telerik:RadCodeBlock>Hope this helps.
Regards,
Konstantin Dikov
Telerik by Progress
Thanks Konstantin!
With the exception of having to remove the line with "var activeItemID" from the code because it did not look it was used and I did not know what it was for, it worked as I wanted it to work.
The only issue I have found was that the bottom part of the grid shows a dark line when the grid loads. See the attached screenshot and note the area circled in RED. It happens under IE, Chrome and FireFox. The DataSource for the RadGrid is a DataSet. This only happens when the table used to populate the DataSet is cleared and populated with new data. If a record is updated or inserted in the table then it no longer occurs until the table is cleared and populated with new data. Also this problem only occurs on the PC with Windows. I tried loading the page in Chrome on the iPhone 6S and did not show the problem. I have tried using ScrollHeight in ClientSettings in the RadGrid to resolve it but it did not resolve it.
What is causing the problem and what to do to resolve it?
Sincerely,
Keith Jackson
I have tested your RadGrid settings locally with our latest version and no issue is observed, which could indicate that you have custom styles that are breaking the structure of the grid.
Can you please remove all custom styles and see if this resolves the problem? If not, please elaborate which version of the controls you are using, so we can test with the same one locally.
Looking forward to your reply.
Regards,
Konstantin Dikov
Telerik by Progress
I am using version 2016.2.504.45 of the Telerik controls.
Please help!
Here is my ASP.Net page:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="InventoryCycleReconciliation.aspx.vb" Inherits="InventoryCycleReconciliation" %><%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <style type="text/css"> .auto-style1 { width: 960px; height: 220px; } .UnknownClass { background-color: #FF0000 /* red */; } .DifLocClass { background-color: yellow; } .MatchClass { background-color: #00FF00 /* green */; } .UnscannedClass { background-color: white; } body { margin: 0; padding: 0; } html { font-size: 120%; float: left; text-align: left; margin-left: 0px; line-height: 1.2; } html .RadMenu .rmLink, html .RadMenu .rmHorizontal .rmText { float: none; padding: 0; text-align: center; } @media (min-width:60em){ html { font-size: 90%; padding-top: 10px; } } @media (max-width:360px){ .RadGrid { width: 300px; } } @media (min-width:361px) and (max-width:768px){ .RadGrid { width: 360px; } } @media (min-width:769px) and (max-width:1024px){ .RadGrid { width: 770px; } } @media (min-width:1025px) and (max-width:1280px){ .RadGrid { width: 955px; } } @media (min-width:1281px){ .RadGrid { width: 955px; } } </style> <meta name="viewport" content="width=device-width, initial-scale=1" /> <script type="text/javascript" src="/scripts/jquery.min.js"></script> <script type = "text/javascript" > function preventBack() { window.history.forward(); } setTimeout("preventBack()", 3); window.onunload = function () { null }; </script> <script type = "text/javascript" > function GridCreated(sender, eventArgs) { //gets the main table scrollArea HTLM element var scrollArea = document.getElementById(sender.get_element().id + "_GridData"); var row = sender.get_masterTableView().get_selectedItems()[0]; //if the position of the selected row is below the viewable grid area alert("row = " + row); if (row) { if ((row.get_element().offsetTop - scrollArea.scrollTop) + row.get_element().offsetHeight + 5 > scrollArea.offsetHeight) { //scroll down to selected row scrollArea.scrollTop = scrollArea.scrollTop + ((row.get_element().offsetTop - scrollArea.scrollTop) + row.get_element().offsetHeight - scrollArea.offsetHeight) + row.get_element().offsetHeight; } //if the position of the the selected row is above the viewable grid area else if ((row.get_element().offsetTop - scrollArea.scrollTop) < 0) { //scroll the selected row to the top scrollArea.scrollTop = row.get_element().offsetTop; } } } </script></head><body style="background-color: #3A4459"> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"> </asp:ScriptReference> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"> </asp:ScriptReference> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"> </asp:ScriptReference> </Scripts> </telerik:RadScriptManager> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function pageLoad() { var grid = $find("<%=rgInvntCycleReconcl.ClientID%>"); var master = grid.get_masterTableView(); if (master.get_selectedItems().length > 0) { var item = master.get_selectedItems()[0]; var rowElement = item.get_element(); var offset = rowElement.offsetTop; setScroll(grid, offset); } } function setScroll(grid, scrollTop) { var dataDiv = $telerik.findElement(grid.get_element(), grid.get_id() + "_GridData"); dataDiv.scrollTop = scrollTop; } </script> </telerik:RadCodeBlock> <div> <telerik:RadPageLayout ID="Radpagelayout1" runat="server" GridType="Fluid" ForeColor="White" ShowGrid="False" EnableAjaxSkinRendering="False" EnableEmbeddedBaseStylesheet="True" EnableEmbeddedScripts="False" EnableEmbeddedSkins="False" HtmlTag="Div" RegisterWithScriptManager="True" RenderMode="Classic"> <Rows> <telerik:LayoutRow Height="40px" HiddenXs="true" HiddenSm="true" HiddenMd="true"> <Columns> <telerik:LayoutColumn Span="5" SpanMd="5" SpanSm="10"> <img alt="RSDC of Michigan" class="auto-style1" src="/images/RSDC_Logo2.jpg" /> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px" HiddenLg="true" HiddenXl="true"> <Columns> <telerik:LayoutColumn Span="7" SpanMd="9" SpanSm="12" SpanXs="12"> <br /> <telerik:RadButton ID="rbtnHome" runat="server" Text="HOME" RenderMode="Lightweight"> </telerik:RadButton> <telerik:RadButton ID="rbtnLogOut" runat="server" Text="LOGOUT" RenderMode="Lightweight"> </telerik:RadButton> <br /> <br /> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px" HiddenXs="true" HiddenSm="true" HiddenMd="true"> <Columns> <telerik:LayoutColumn Span="5" SpanMd="8" SpanSm="12"> <br /> <telerik:RadMenu ID="RadMenu1" Runat="server" Width="960px" Style="z-index: 50"> <Items> <telerik:RadMenuItem runat="server" Font-Bold="True" Font-Size="14pt" NavigateUrl="CustomerPortal" Text="Home" Width="475px"> </telerik:RadMenuItem> <telerik:RadMenuItem runat="server" IsSeparator="True" Text="Sep"> </telerik:RadMenuItem> <telerik:RadMenuItem runat="server" Font-Bold="True" Font-Size="14pt" ForeColor="Red" Text="Logout" Width="475px"> </telerik:RadMenuItem> </Items> </telerik:RadMenu> <br /> <br /> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px"> <Columns> <telerik:LayoutColumn Span="6" SpanMd="6" SpanSm="12"> <asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="White" Width="300px" Text="Inventory Cycle Reconciliation"></asp:Label> <br /> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px"> <Columns> <telerik:LayoutColumn Span="3" SpanXl="1" SpanLg="1" SpanMd="2" SpanSm="2"> Bay </telerik:LayoutColumn> <telerik:LayoutColumn Span="3" SpanXl="2" SpanLg="2" SpanMd="2" SpanSm="4" SpanXs="4"> <telerik:RadComboBox ID="rcbbBay" runat="server" MaxHeight="250px" AutoPostBack="true" Width="115px" RenderMode="Lightweight"> <Items> <telerik:RadComboBoxItem runat="server" Text="A - Bay" Value="A - Bay" /> <telerik:RadComboBoxItem runat="server" Text="B - Bay" Value="B - Bay" /> <telerik:RadComboBoxItem runat="server" Text="C - Bay" Value="C - Bay" /> <telerik:RadComboBoxItem runat="server" Text="D - Bay" Value="D - Bay" /> <telerik:RadComboBoxItem runat="server" Text="E - Bay" Value="E - Bay" /> <telerik:RadComboBoxItem runat="server" Text="F - Bay" Value="F - Bay" /> <telerik:RadComboBoxItem runat="server" Text="G - Bay" Value="G - Bay" /> </Items> </telerik:RadComboBox> </telerik:LayoutColumn> <telerik:LayoutColumn Span="3" SpanXl="3" SpanLg="3" SpanMd="3" SpanSm="3"> <telerik:RadTextBox ID="rtxtSerialNbr" Runat="server" EmptyMessage="Enter Serial#" Width="125px" RenderMode="Lightweight"> <EmptyMessageStyle Resize="None"></EmptyMessageStyle> <ReadOnlyStyle Resize="None"></ReadOnlyStyle> <FocusedStyle Resize="None"></FocusedStyle> <DisabledStyle Resize="None"></DisabledStyle> <InvalidStyle Resize="None"></InvalidStyle> <HoveredStyle Resize="None"></HoveredStyle> <EnabledStyle Resize="None"></EnabledStyle> </telerik:RadTextBox> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px"> <Columns> <telerik:LayoutColumn Span="3" SpanXl="1" SpanLg="1" SpanMd="2" SpanSm="2"> Column </telerik:LayoutColumn> <telerik:LayoutColumn Span="3" SpanXl="2" SpanLg="2" SpanMd="2" SpanSm="4" SpanXs="4"> <telerik:RadComboBox ID="rcbbCol1" runat="server" MaxHeight="250px" Width="115px" AutoPostBack="true" RenderMode="Lightweight"> </telerik:RadComboBox> </telerik:LayoutColumn> <telerik:LayoutColumn Span="3" SpanMd="3" SpanSm="3"> <telerik:RadButton ID="rbtnScan" runat="server" Text="SCAN" RenderMode="Lightweight" ValidationGroup="Submit"> </telerik:RadButton> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow> <Columns> <telerik:LayoutColumn Span="3" SpanXl="1" SpanLg="1" SpanMd="2" SpanSm="2"> Row </telerik:LayoutColumn> <telerik:LayoutColumn Span="3" SpanXl="2" SpanLg="2" SpanMd="2" SpanSm="4" SpanXs="4"> <telerik:RadComboBox ID="rcbbRow1" runat="server" MaxHeight="250px" Width="115px" AutoPostBack="true" RenderMode="Lightweight"> <Items> <telerik:RadComboBoxItem runat="server" Text="01" Value="01" /> <telerik:RadComboBoxItem runat="server" Text="02" Value="02" /> <telerik:RadComboBoxItem runat="server" Text="03" Value="03" /> <telerik:RadComboBoxItem runat="server" Text="04" Value="04" /> <telerik:RadComboBoxItem runat="server" Text="05" Value="05" /> <telerik:RadComboBoxItem runat="server" Text="06" Value="06" /> <telerik:RadComboBoxItem runat="server" Text="07" Value="07" /> <telerik:RadComboBoxItem runat="server" Text="08" Value="08" /> <telerik:RadComboBoxItem runat="server" Text="09" Value="09" /> <telerik:RadComboBoxItem runat="server" Text="10" Value="10" /> <telerik:RadComboBoxItem runat="server" Text="11" Value="11" /> <telerik:RadComboBoxItem runat="server" Text="12" Value="12" /> <telerik:RadComboBoxItem runat="server" Text="13" Value="13" /> <telerik:RadComboBoxItem runat="server" Text="14" Value="14" /> <telerik:RadComboBoxItem runat="server" Text="15" Value="15" /> <telerik:RadComboBoxItem runat="server" Text="16" Value="16" /> <telerik:RadComboBoxItem runat="server" Text="17" Value="17" /> <telerik:RadComboBoxItem runat="server" Text="18" Value="18" /> <telerik:RadComboBoxItem runat="server" Text="19" Value="19" /> <telerik:RadComboBoxItem runat="server" Text="20" Value="20" /> <telerik:RadComboBoxItem runat="server" Text="21" Value="21" /> <telerik:RadComboBoxItem runat="server" Text="22" Value="22" /> <telerik:RadComboBoxItem runat="server" Text="23" Value="23" /> <telerik:RadComboBoxItem runat="server" Text="24" Value="24" /> <telerik:RadComboBoxItem runat="server" Text="25" Value="25" /> <telerik:RadComboBoxItem runat="server" Text="26" Value="26" /> <telerik:RadComboBoxItem runat="server" Text="27" Value="27" /> <telerik:RadComboBoxItem runat="server" Text="28" Value="28" /> <telerik:RadComboBoxItem runat="server" Text="29" Value="29" /> <telerik:RadComboBoxItem runat="server" Text="30" Value="30" /> <telerik:RadComboBoxItem runat="server" Text="31" Value="31" /> <telerik:RadComboBoxItem runat="server" Text="32" Value="32" /> <telerik:RadComboBoxItem runat="server" Text="33" Value="33" /> <telerik:RadComboBoxItem runat="server" Text="34" Value="34" /> <telerik:RadComboBoxItem runat="server" Text="35" Value="35" /> <telerik:RadComboBoxItem runat="server" Text="36" Value="36" /> <telerik:RadComboBoxItem runat="server" Text="37" Value="37" /> <telerik:RadComboBoxItem runat="server" Text="38" Value="38" /> <telerik:RadComboBoxItem runat="server" Text="39" Value="39" /> <telerik:RadComboBoxItem runat="server" Text="40" Value="40" /> <telerik:RadComboBoxItem runat="server" Text="41" Value="41" /> <telerik:RadComboBoxItem runat="server" Text="42" Value="42" /> <telerik:RadComboBoxItem runat="server" Text="43" Value="43" /> <telerik:RadComboBoxItem runat="server" Text="44" Value="44" /> <telerik:RadComboBoxItem runat="server" Text="45" Value="45" /> <telerik:RadComboBoxItem runat="server" Text="46" Value="46" /> <telerik:RadComboBoxItem runat="server" Text="47" Value="47" /> <telerik:RadComboBoxItem runat="server" Text="48" Value="48" /> <telerik:RadComboBoxItem runat="server" Text="49" Value="49" /> <telerik:RadComboBoxItem runat="server" Text="50" Value="50" /> <telerik:RadComboBoxItem runat="server" Text="51" Value="51" /> <telerik:RadComboBoxItem runat="server" Text="52" Value="52" /> <telerik:RadComboBoxItem runat="server" Text="53" Value="53" /> <telerik:RadComboBoxItem runat="server" Text="54" Value="54" /> <telerik:RadComboBoxItem runat="server" Text="55" Value="55" /> <telerik:RadComboBoxItem runat="server" Text="56" Value="56" /> <telerik:RadComboBoxItem runat="server" Text="57" Value="57" /> <telerik:RadComboBoxItem runat="server" Text="58" Value="58" /> <telerik:RadComboBoxItem runat="server" Text="59" Value="59" /> <telerik:RadComboBoxItem runat="server" Text="60" Value="60" /> <telerik:RadComboBoxItem runat="server" Text="61" Value="61" /> <telerik:RadComboBoxItem runat="server" Text="62" Value="62" /> <telerik:RadComboBoxItem runat="server" Text="63" Value="63" /> <telerik:RadComboBoxItem runat="server" Text="64" Value="64" /> <telerik:RadComboBoxItem runat="server" Text="65" Value="65" /> <telerik:RadComboBoxItem runat="server" Text="66" Value="66" /> <telerik:RadComboBoxItem runat="server" Text="67" Value="67" /> <telerik:RadComboBoxItem runat="server" Text="68" Value="68" /> <telerik:RadComboBoxItem runat="server" Text="69" Value="69" /> <telerik:RadComboBoxItem runat="server" Text="70" Value="70" /> <telerik:RadComboBoxItem runat="server" Text="81" Value="81" /> <telerik:RadComboBoxItem runat="server" Text="82" Value="82" /> <telerik:RadComboBoxItem runat="server" Text="83" Value="83" /> <telerik:RadComboBoxItem runat="server" Text="84" Value="84" /> <telerik:RadComboBoxItem runat="server" Text="85" Value="85" /> <telerik:RadComboBoxItem runat="server" Text="86" Value="86" /> <telerik:RadComboBoxItem runat="server" Text="87" Value="87" /> <telerik:RadComboBoxItem runat="server" Text="88" Value="88" /> <telerik:RadComboBoxItem runat="server" Text="89" Value="89" /> <telerik:RadComboBoxItem runat="server" Text="90" Value="90" /> <telerik:RadComboBoxItem runat="server" Text="91" Value="91" /> <telerik:RadComboBoxItem runat="server" Text="92" Value="92" /> <telerik:RadComboBoxItem runat="server" Text="93" Value="93" /> <telerik:RadComboBoxItem runat="server" Text="94" Value="94" /> <telerik:RadComboBoxItem runat="server" Text="95" Value="95" /> <telerik:RadComboBoxItem runat="server" Text="96" Value="96" /> <telerik:RadComboBoxItem runat="server" Text="97" Value="97" /> <telerik:RadComboBoxItem runat="server" Text="98" Value="98" /> <telerik:RadComboBoxItem runat="server" Text="99" Value="99" /> </Items> </telerik:RadComboBox> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px"> <Columns> <telerik:LayoutColumn Span="4" SpanXl="12" SpanLg="12" SpanMd="9" SpanSm="10" SpanXs="8"> <br /> <telerik:RadLabel ID="rlblMessage" runat="server" RenderMode="Lightweight"></telerik:RadLabel> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> <telerik:LayoutRow Height="40px"> <Columns> <telerik:LayoutColumn Span="4" SpanXl="12" SpanLg="12" SpanMd="9" SpanSm="10" SpanXs="8"> <br /> <telerik:RadGrid ID="rgInvntCycleReconcl" runat="server" GroupPanelPosition="Top" Height="246px" AutoGenerateColumns="False" AllowPaging="false" RenderMode="Auto" OnNeedDataSource="rgInvntCycleReconcl_NeedDataSource"> <GroupingSettings CollapseAllTooltip="Collapse all groups" /> <ExportSettings IgnorePaging="True"> <Pdf AllowPrinting="False"> </Pdf> <Excel FileExtension="xlsx" Format="Xlsx" /> </ExportSettings> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" /> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView EnableViewState="true" Font-Size="Medium" DataKeyNames="SERIAL_NO"> <Columns> <telerik:GridBoundColumn DataField="SERIAL_NO" FilterControlAltText="Filter column column" HeaderText="Serial No." ReadOnly="True" UniqueName="SerialNbr"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="LOCATION" FilterControlAltText="Filter column1 column" HeaderText="Location" ReadOnly="True" UniqueName="Location"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="STATUS" FilterControlAltText="Filter column2 column" HeaderText="Status" ReadOnly="True" UniqueName="Status"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SCAN_LOC" FilterControlAltText="Filter column3 column" HeaderText="Scan Location" ReadOnly="True" UniqueName="ScanLocation"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="WEIGHT_KGS" FilterControlAltText="Filter column4 column" HeaderText="Weight KGS" ReadOnly="True" UniqueName="WeightKGS"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <PagerStyle Mode="NextPrevNumericAndAdvanced" /> </telerik:RadGrid> </telerik:LayoutColumn> </Columns> </telerik:LayoutRow> </Rows> </telerik:RadPageLayout> </div> </form></body></html>Here is the VB.Net code-behind:
Imports System.DataImports System.Text.RegularExpressionsImports Telerik.Web.UIPartial Class InventoryCycleReconciliation Inherits System.Web.UI.Page Private sql As String Private bHasError As Boolean = False, strErrorMsg As String Private strSQLResult As String Private myDSData As DataSet Private Sub SetFilterFields() Try Dim ABayColNbrList As New ArrayList, BBayColNbrList As New ArrayList, CBayColNbrList As New ArrayList Dim DEFGBayColNbrList As New ArrayList Dim strBay As String = "A" Dim strColumn As String = "", strRow As String = "" Dim strScanLoc As String = "" Dim strUser As String = "", strDecUser As String = "" If Not Session("UserName") Is Nothing Then strUser = CType(Session("UserName"), String) strDecUser = DataEncryption.base64Decode(strUser) strDecUser = DataEncryption.base64Decode(strDecUser) strDecUser = DataEncryption.base64Decode(strDecUser) strUser = strDecUser End If ' Display Table name for specific users. 'If strUser = "KMJ9263" Or strUser = "DLM4221" Then ' lblTable.Text = "( VIEW_PLEX_ACTIVE_INVENTORY )" 'End If ' A - Bay Column Number List For x As Integer = 1 To 4 ABayColNbrList.Add(x.ToString("00")) Next ' B - Bay Column Number List For x As Integer = 5 To 8 BBayColNbrList.Add(x.ToString("00")) Next ' C - Bay Column Number List For x As Integer = 9 To 12 CBayColNbrList.Add(x.ToString("00")) Next ' Column Number List for D-Bay, E-Bay, F-Bay, and G-Bay. For x As Integer = 1 To 26 DEFGBayColNbrList.Add(x.ToString("00")) Next ' Save Column Numbers in Session variables. Session("INVNTRYCYCLERECONCLABAYCOLNBRS") = ABayColNbrList Session("INVNTRYCYCLERECONCLBBAYCOLNBRS") = BBayColNbrList Session("INVNTRYCYCLERECONCLCBAYCOLNBRS") = CBayColNbrList Session("INVNTRYCYCLERECONCLDEFGBAYCOLNBRS") = DEFGBayColNbrList ' Bay If Not (Session("INVNTRYCYCLERECONCLBAY") Is Nothing) Then rcbbBay.Items.FindItemByValue(CType(Session("INVNTRYCYCLERECONCLBAY"), String)).Selected = True strBay = Left(rcbbBay.SelectedValue.Trim, 1) End If ' Column Range If rcbbCol1.Items.Count > 0 Then rcbbCol1.DataSource = Nothing rcbbCol1.Items.Clear() End If Select Case strBay Case "A" rcbbCol1.DataSource = ABayColNbrList rcbbCol1.DataBind() Case "B" rcbbCol1.DataSource = BBayColNbrList rcbbCol1.DataBind() Case "C" rcbbCol1.DataSource = CBayColNbrList rcbbCol1.DataBind() Case Else rcbbCol1.DataSource = DEFGBayColNbrList rcbbCol1.DataBind() End Select If Not (Session("INVNTRYCYCLERECONCLCOLNBR") Is Nothing) Then rcbbCol1.Items.FindItemByValue(CType(Session("INVNTRYCYCLERECONCLCOLNBR"), String)).Selected = True End If strColumn = rcbbCol1.SelectedValue.ToString() ' Row Range If strBay = "D" Or strBay = "E" Or strBay = "F" Or strBay = "G" Then rcbbRow1.Enabled = False strScanLoc = strBay & strColumn Else If Not (Session("INVNTRYCYCLERECONCLROWNBR") Is Nothing) Then rcbbRow1.Items.FindItemByValue(CType(Session("INVNTRYCYCLERECONCLROWNBR"), String)).Selected = True End If strRow = rcbbRow1.SelectedValue.ToString() strScanLoc = strBay & strColumn & "R" & strRow End If ' Set up SQL statement for Grid. sql = "SELECT SERIAL_NO, LOCATION, STATUS, SCAN_LOC, WEIGHT_KGS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE LOCATION = '" & strScanLoc & "' OR SCAN_LOC = '" & strScanLoc & "' ORDER BY SERIAL_NO" Session("INVNTRYCYCLERECONCLSQLSTRING") = sql ' Set focus to Serial Number textbox rtxtSerialNbr.Focus() rtxtSerialNbr.Attributes.Add("onfocus", "this.select();") Catch ex As Exception strErrorMsg = "Procedure: SetFilterFields() - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Try Dim strUser As String = "" Dim strDecUser As String = "" Dim strAppName As String = "IPMENUINVNTRYCYCLERECONCLTN" If Request.IsAuthenticated Then 'If IsPostBack Then 'End If If Not Session("UserName") Is Nothing Then strUser = CType(Session("UserName"), String) strDecUser = DataEncryption.base64Decode(strUser) strDecUser = DataEncryption.base64Decode(strDecUser) strDecUser = DataEncryption.base64Decode(strDecUser) strUser = strDecUser End If If LoginValidation.IsValidAppAccess(strUser, strAppName) Then UserFunctions.UpdateAppActivity(strUser, strAppName) SetFilterFields() Else Response.Redirect("CustomerPortal") End If Else FormsAuthentication.RedirectToLoginPage() End If Catch ex As Exception strErrorMsg = "Procedure: Page_Init - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rcbbBay_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles rcbbBay.SelectedIndexChanged Try Dim ABayColNbrList As New ArrayList, BBayColNbrList As New ArrayList, CBayColNbrList As New ArrayList Dim DEFGBayColNbrList As New ArrayList Dim strBay As String = "" Dim strColumn As String = "", strRow As String = "" Dim strScanLoc As String = "" ' Column Number List for each Bay. ABayColNbrList = CType(Session("INVNTRYCYCLERECONCLABAYCOLNBRS"), ArrayList) BBayColNbrList = CType(Session("INVNTRYCYCLERECONCLBBAYCOLNBRS"), ArrayList) CBayColNbrList = CType(Session("INVNTRYCYCLERECONCLCBAYCOLNBRS"), ArrayList) DEFGBayColNbrList = CType(Session("INVNTRYCYCLERECONCLDEFGBAYCOLNBRS"), ArrayList) ' Bay strBay = Left(rcbbBay.SelectedValue.Trim, 1) ' Column Range If rcbbCol1.Items.Count > 0 Then rcbbCol1.DataSource = Nothing rcbbCol1.Items.Clear() End If Select Case strBay Case "A" rcbbCol1.DataSource = ABayColNbrList rcbbCol1.DataBind() rcbbRow1.Enabled = True Case "B" rcbbCol1.DataSource = BBayColNbrList rcbbCol1.DataBind() rcbbRow1.Enabled = True Case "C" rcbbCol1.DataSource = CBayColNbrList rcbbCol1.DataBind() rcbbRow1.Enabled = True Case Else rcbbCol1.DataSource = DEFGBayColNbrList rcbbCol1.DataBind() rcbbRow1.Enabled = False End Select strColumn = rcbbCol1.SelectedValue.ToString() If rcbbRow1.Enabled Then strRow = rcbbRow1.SelectedValue.ToString() strScanLoc = strBay & strColumn & "R" & strRow Else strScanLoc = strBay & strColumn End If ' Rebind grid with the records for the new Scan Location. sql = "SELECT SERIAL_NO, LOCATION, STATUS, SCAN_LOC, WEIGHT_KGS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE LOCATION = '" & strScanLoc & "' OR SCAN_LOC = '" & strScanLoc & "' ORDER BY SERIAL_NO" Session("INVNTRYCYCLERECONCLSQLSTRING") = sql Session("INVNTRYCYCLERECONCLBAY") = rcbbBay.SelectedValue.Trim Session("INVNTRYCYCLERECONCLCOLNBR") = rcbbCol1.SelectedValue.Trim Session("INVNTRYCYCLERECONCLROWNBR") = rcbbRow1.SelectedValue.Trim rgInvntCycleReconcl.Rebind() ' Set focus to Serial Number textbox rtxtSerialNbr.Focus() rtxtSerialNbr.Attributes.Add("onfocus", "this.select();") Catch ex As Exception strErrorMsg = "Procedure: rcbbBay_SelectedIndexChanged - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rcbbCol1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles rcbbCol1.SelectedIndexChanged Try Dim strBay As String = "" Dim strColumn As String = "", strRow As String = "" Dim strScanLoc As String = "" ' Bay strBay = Left(rcbbBay.SelectedValue.Trim, 1) ' Column strColumn = rcbbCol1.SelectedValue.ToString() ' Row If rcbbRow1.Enabled Then strRow = rcbbRow1.SelectedValue.ToString() strScanLoc = strBay & strColumn & "R" & strRow Else strScanLoc = strBay & strColumn End If ' Rebind grid with the records for the new Scan Location. sql = "SELECT SERIAL_NO, LOCATION, STATUS, SCAN_LOC, WEIGHT_KGS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE LOCATION = '" & strScanLoc & "' OR SCAN_LOC = '" & strScanLoc & "' ORDER BY SERIAL_NO" Session("INVNTRYCYCLERECONCLSQLSTRING") = sql Session("INVNTRYCYCLERECONCLBAY") = rcbbBay.SelectedValue.Trim Session("INVNTRYCYCLERECONCLCOLNBR") = rcbbCol1.SelectedValue.Trim Session("INVNTRYCYCLERECONCLROWNBR") = rcbbRow1.SelectedValue.Trim rgInvntCycleReconcl.Rebind() ' Set focus to Serial Number textbox rtxtSerialNbr.Focus() rtxtSerialNbr.Attributes.Add("onfocus", "this.select();") Catch ex As Exception strErrorMsg = "Procedure: rcbbCol1_SelectedIndexChanged - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rcbbRow1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles rcbbRow1.SelectedIndexChanged Try Dim strBay As String = "" Dim strColumn As String = "", strRow As String = "" Dim strScanLoc As String = "" ' Bay strBay = Left(rcbbBay.SelectedValue.Trim, 1) ' Column strColumn = rcbbCol1.SelectedValue.ToString() ' Row If rcbbRow1.Enabled Then strRow = rcbbRow1.SelectedValue.ToString() strScanLoc = strBay & strColumn & "R" & strRow Else strScanLoc = strBay & strColumn End If ' Rebind grid with the records for the new Scan Location. sql = "SELECT SERIAL_NO, LOCATION, STATUS, SCAN_LOC, WEIGHT_KGS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE LOCATION = '" & strScanLoc & "' OR SCAN_LOC = '" & strScanLoc & "' ORDER BY SERIAL_NO" Session("INVNTRYCYCLERECONCLSQLSTRING") = sql Session("INVNTRYCYCLERECONCLBAY") = rcbbBay.SelectedValue.Trim Session("INVNTRYCYCLERECONCLCOLNBR") = rcbbCol1.SelectedValue.Trim Session("INVNTRYCYCLERECONCLROWNBR") = rcbbRow1.SelectedValue.Trim rgInvntCycleReconcl.Rebind() ' Set focus to Serial Number textbox rtxtSerialNbr.Focus() rtxtSerialNbr.Attributes.Add("onfocus", "this.select();") Catch ex As Exception strErrorMsg = "Procedure: rcbbRow1_SelectedIndexChanged - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rbtnHome_Click(sender As Object, e As EventArgs) Handles rbtnHome.Click Try Response.Redirect("CustomerPortal") Catch ex As Exception strErrorMsg = "Procedure: rbtnHome_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rbtnLogOut_Click(sender As Object, e As EventArgs) Handles rbtnLogOut.Click Try LoginValidation.LogoutUser() Catch ex As Exception strErrorMsg = "Procedure: rbtnLogOut_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rbtnScan_Click(sender As Object, e As EventArgs) Handles rbtnScan.Click Try Dim strBay As String = "" Dim strColumn As String = "", strRow As String = "" Dim strScanLoc As String = "", strLocationFound As String = "" Dim strSerialNbr As String = rtxtSerialNbr.Text.Trim.ToUpper Dim dsSerialNbr As DataSet Dim bValidSerialNbr As Boolean = False, bSerialNbrChecked As Boolean = False Dim strStatus As String = "" ' Reset label for messages. rlblMessage.Font.Bold = False rlblMessage.ForeColor = Drawing.Color.White rlblMessage.BackColor = Drawing.ColorTranslator.FromHtml("#3A4459") rlblMessage.Text = "" ' Check if valid Serial Number ' Note 1: Valid Serial Numbers start with A, B, K, or M. ' Note 2: If Serial Number scanned (starts with S and has 9 digits starting with 3) or (does not start with S and has 9 digits starting with 3) then need to query VIEW_PLEX_ACTIVE_INVENTORY where ' RSDCID equals the 9 digits to find the SERIAL_NO. If it is found then use the Serial Number to check the Scan location and such. If Not String.IsNullOrWhiteSpace(strSerialNbr) Then If Regex.IsMatch(strSerialNbr, "^[A-Z0-9]*$") Then ' Is Serial Number only Letters and/or Numbers ' Serial Number has S prefix? If Mid(strSerialNbr, 1, 1) = "S" Then strSerialNbr = Mid(strSerialNbr, 2) ' Strip off the S prefix. If Len(strSerialNbr) = 9 Then If IsNumeric(strSerialNbr) Then If Mid(strSerialNbr, 1, 1) = "3" Then sql = "SELECT SERIAL_NO FROM VIEW_PLEX_ACTIVE_INVENTORY WHERE RSDCID = '" & strSerialNbr & "'" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count > 0 Then strSerialNbr = IIf(Not IsDBNull(dsSerialNbr.Tables(0).Rows(0)(0)), dsSerialNbr.Tables(0).Rows(0)(0).ToString, "") If Not String.IsNullOrWhiteSpace(strSerialNbr) Then bValidSerialNbr = True bSerialNbrChecked = True Else strStatus = "UNKNOWN" bSerialNbrChecked = True End If Else strStatus = "UNKNOWN" bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If End If ' Serial Number start with 3? If Not bSerialNbrChecked Then ' Check Serial Number if not already checked. If Mid(strSerialNbr, 1, 1) = "3" Then If Len(strSerialNbr) = 9 Then If IsNumeric(strSerialNbr) Then If Mid(strSerialNbr, 1, 1) = "3" Then sql = "SELECT SERIAL_NO FROM VIEW_PLEX_ACTIVE_INVENTORY WHERE RSDCID = '" & strSerialNbr & "'" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count > 0 Then strSerialNbr = IIf(Not IsDBNull(dsSerialNbr.Tables(0).Rows(0)(0)), dsSerialNbr.Tables(0).Rows(0)(0).ToString, "") If Not String.IsNullOrWhiteSpace(strSerialNbr) Then bValidSerialNbr = True bSerialNbrChecked = True Else strStatus = "UNKNOWN" bSerialNbrChecked = True End If Else strStatus = "UNKNOWN" bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If Else bSerialNbrChecked = True End If End If End If ' Serial Number start with A, B, K, or M? If Not bSerialNbrChecked Then ' Check Serial Number if not already checked. If Mid(strSerialNbr, 1, 1) = "A" Or Mid(strSerialNbr, 1, 1) = "B" Or Mid(strSerialNbr, 1, 1) = "K" Or Mid(strSerialNbr, 1, 1) = "M" Then bValidSerialNbr = True End If End If End If ' Bay strBay = Left(rcbbBay.SelectedValue.Trim, 1) ' Column strColumn = rcbbCol1.SelectedValue.ToString() ' Row If rcbbRow1.Enabled Then strRow = rcbbRow1.SelectedValue.ToString() strScanLoc = strBay & strColumn & "R" & strRow Else strScanLoc = strBay & strColumn End If If bValidSerialNbr And String.IsNullOrWhiteSpace(strStatus) Then ' Check if Serial Number scanned/entered exists in the Scan Location. sql = "SELECT LOCATION, STATUS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE (LOCATION = '" & strScanLoc & "') AND (SERIAL_NO = '" & strSerialNbr & "') ORDER BY SERIAL_NO" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count > 0 Then strStatus = UCase(dsSerialNbr.Tables(0).Rows(0)(1).ToString) If strStatus = "UN-SCANNED" Then ' Update the Status. sql = "UPDATE ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY SET STATUS = 'MATCH', SCAN_LOC = '" & strScanLoc & "' WHERE (LOCATION = '" & strScanLoc & "') AND SERIAL_NO = '" & strSerialNbr & "'" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Update error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If End If Else ' Check if Serial Number scanned/entered exists in the Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "SELECT LOCATION, STATUS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE SERIAL_NO = '" & strSerialNbr & "' ORDER BY SERIAL_NO" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count > 0 Then strStatus = UCase(dsSerialNbr.Tables(0).Rows(0)(1).ToString) If strStatus = "UN-SCANNED" Then strLocationFound = IIf(Not IsDBNull(dsSerialNbr.Tables(0).Rows(0)(0)), dsSerialNbr.Tables(0).Rows(0)(0).ToString, "") If Not String.IsNullOrWhiteSpace(strLocationFound) Then If strLocationFound <> strScanLoc Then ' Update the Status. sql = "UPDATE ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY SET STATUS = 'DIF-LOC', SCAN_LOC = '" & strScanLoc & "' WHERE SERIAL_NO = '" & strSerialNbr & "'" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Update error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If End If End If End If Else ' Check if Serial Number scanned/entered exists in VIEW_PLEX_ACTIVE_INVENTORY. sql = "SELECT LOCATION FROM VIEW_PLEX_ACTIVE_INVENTORY WHERE SERIAL_NO = '" & strSerialNbr & "' ORDER BY SERIAL_NO" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count > 0 Then strLocationFound = IIf(Not IsDBNull(dsSerialNbr.Tables(0).Rows(0)(0)), dsSerialNbr.Tables(0).Rows(0)(0).ToString, "") If Not String.IsNullOrWhiteSpace(strLocationFound) Then ' Insert record into Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "INSERT INTO ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY (SERIAL_NO, LOCATION, STATUS, SCAN_LOC) VALUES('" & strSerialNbr & "','" & strLocationFound & "','DIF-LOC','" & strScanLoc & "')" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Insert error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If Else ' Insert record into Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "INSERT INTO ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY (SERIAL_NO, LOCATION, STATUS, SCAN_LOC) VALUES('" & strSerialNbr & "','" & strLocationFound & "','UNKNOWN','" & strScanLoc & "')" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Insert error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If End If Else ' Insert record into Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "INSERT INTO ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY (SERIAL_NO, STATUS, SCAN_LOC) VALUES('" & strSerialNbr & "','UNKNOWN','" & strScanLoc & "')" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Insert error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If End If End If End If ' Rebind Grid to show status of scan. rgInvntCycleReconcl.Rebind() ' Select Row with Serial Number Dim gdiItem As GridDataItem = rgInvntCycleReconcl.MasterTableView.FindItemByKeyValue("SERIAL_NO", strSerialNbr) If Not gdiItem Is Nothing Then gdiItem.Selected = True End If Else If Not String.IsNullOrWhiteSpace(strStatus) Then ' Check if Serial Number scanned/entered exists in the Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "SELECT LOCATION FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY WHERE SERIAL_NO = '" & strSerialNbr & "' ORDER BY SERIAL_NO" dsSerialNbr = DataSetConfiguration.OracleDataSet(sql, "S01") If dsSerialNbr.Tables(0).Rows.Count = 0 Then ' Insert record into Temp table (PLEX_ACTIVE_CYCLE_INVENTORY). sql = "INSERT INTO ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY (SERIAL_NO, STATUS, SCAN_LOC) VALUES('" & strSerialNbr & "','" & strStatus & "','" & strScanLoc & "')" strSQLResult = SQLExecution.SQLCommand(sql, "S01") If Not String.IsNullOrWhiteSpace(strSQLResult) Then strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: Insert error - " & strSQLResult UserFunctions.UserMsgBox(Me, strErrorMsg) End If ' Rebind Grid to show status of scan. rgInvntCycleReconcl.Rebind() ' Select Row with Serial Number Dim gdiItem As GridDataItem = rgInvntCycleReconcl.MasterTableView.FindItemByKeyValue("SERIAL_NO", strSerialNbr) If Not gdiItem Is Nothing Then gdiItem.Selected = True End If Else ' Select Row with Serial Number Dim gdiItem As GridDataItem = rgInvntCycleReconcl.MasterTableView.FindItemByKeyValue("SERIAL_NO", strSerialNbr) If Not gdiItem Is Nothing Then gdiItem.Selected = True End If End If Else strErrorMsg = "Invalid Serial Number!" rlblMessage.ForeColor = Drawing.Color.Red rlblMessage.BackColor = Drawing.Color.White rlblMessage.Text = strErrorMsg End If End If Else strErrorMsg = "No Serial # scanned\entered!" rlblMessage.ForeColor = Drawing.Color.Red rlblMessage.BackColor = Drawing.Color.White rlblMessage.Text = strErrorMsg End If ' Set focus to Serial Number textbox rtxtSerialNbr.Focus() rtxtSerialNbr.Attributes.Add("onfocus", "this.select();") Catch ex As Exception strErrorMsg = "Procedure: rbtnScan_Click - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rgInvntCycleReconcl_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles rgInvntCycleReconcl.ItemDataBound Try 'Is it a GridDataItem If (TypeOf (e.Item) Is GridDataItem) Then 'Get the instance of the right type Dim dataBoundItem As GridDataItem = CType(e.Item, GridDataItem) 'when "INACTIVE" then Red 'when "MATCH" then Green 'when "DIF-LOC" then Yellow 'when "UNKNOWN" then Red Select Case dataBoundItem("Status").Text.ToUpper Case "INACTIVE" dataBoundItem("Status").CssClass = "UnknownClass" Case "MATCH" dataBoundItem("Status").CssClass = "MatchClass" Case "DIF-LOC" dataBoundItem("Status").CssClass = "DifLocClass" Case "UNKNOWN" dataBoundItem("Status").CssClass = "UnknownClass" Case Else 'dataBoundItem("Status").CssClass = "UnscannedClass" End Select End If Catch ex As Exception strErrorMsg = "Procedure: rgInvntCycleReconcl_ItemDataBound - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub rgInvntCycleReconcl_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles rgInvntCycleReconcl.NeedDataSource Try If (Session("INVNTRYCYCLERECONCLSQLSTRING") Is Nothing) Then sql = "SELECT SERIAL_NO, LOCATION, STATUS, SCAN_LOC, WEIGHT_KGS FROM ADMIN.PLEX_ACTIVE_CYCLE_INVENTORY ORDER BY SERIAL_NO" Else sql = CType(Session("INVNTRYCYCLERECONCLSQLSTRING"), String) End If myDSData = DataSetConfiguration.OracleDataSet(sql, "S01") rgInvntCycleReconcl.DataSource = myDSData Catch ex As Exception strErrorMsg = "Procedure: rgInvntCycleReconcl_NeedDataSource - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End Sub Protected Sub RadMenu1_ItemClick(sender As Object, e As RadMenuEventArgs) Handles RadMenu1.ItemClick Try Dim currentItem As RadMenuItem = RadMenu1.FindItemByText("Logout") If Not currentItem Is Nothing Then If currentItem.Selected Then LoginValidation.LogoutUser() End If End If Catch ex As Exception strErrorMsg = "Procedure: RadMenu1_ItemClick - InventoryCycleReconciliation" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source UserFunctions.UserMsgBox(Me, strErrorMsg) End Try End SubEnd ClassPlease try to remove the Height of the RadGrid and control its height through the ScrollHeight property:
<ClientSettings> <Scrolling ScrollHeight="220" /></ClientSettings>Let me know if this helps.
Regards,
Konstantin Dikov
Telerik by Progress
Thanks Konstantin! That helped to resolve that issue.
Sincerely,
Keith Jackson
