Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Need assistance with WebDataGrid not showing data
posted

I am upgrading the website to Framework 4.6.2 and from Infragistics2 Version=10.2.20102.2018  to Infragistics45 Version=19.1.20191.177.
I work with Visual Studio 2017.
I hope that you can help me with the WebDataGrid problem.
When I pass the search value to the page the data is shown in the grid. When I change the search value and click the search
button the data is not shown.
Everything works fine in old version of Infragistics.
The aspx and vb code are below.
Please let me know what else you need to see.

Thank you very much.

<%@ Page Title="Member Search Results" Language="VB" MasterPageFile="~/MPA.master" AutoEventWireup="false" CodeFile="SearchResults.aspx.vb" Inherits="Members_SearchResults" %>

<%@ MasterType TypeName="MPA" %>

<%@ Register TagPrefix="ig" Namespace="Infragistics.Web.UI.GridControls" Assembly="Infragistics45.Web.v19.1, Version=19.1.20191.177, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>

<%@ Register TagPrefix="igmisc" Namespace="Infragistics.WebUI.Misc" Assembly="Infragistics45.WebUI.Misc.v19.1, Version=19.1.20191.177, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>

<%@ Register TagPrefix="uc1" src="~/Common/ucCustomPager.ascx" tagname="ucCustomPager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script type="text/javascript" language="javascript">

function clickRecall(e) {

var evt = e ? e : window.event;

var bt1 = document.getElementById('<%= cmdRecallPrev.ClientID %>');

var bt2 = document.getElementById('<%= cmdRecallPrev.ClientID %>');

// debugger;

switch (e.keyCode) {

case 38:

//alert('up');

bt1.click()

break;

case 40:

//alert('down');

bt2.click()

break;

case 113:

// F2

bt1.click();

return false;

}

}

/* Retain element focus after UpdatePanel postback

***************************************************/

jQuery(function($) {

var focusedElementSelector = "";

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_beginRequest(function(source, args) {

var fe = document.activeElement;

focusedElementSelector = "";

if (fe != null) {

if (fe.id) {

focusedElementSelector = "#" + fe.id;

} else {

// Handle Chosen Js Plugin

var $chzn = $(fe).closest('.chosen-container[id]');

if ($chzn.size() > 0) {

focusedElementSelector = '#' + $chzn.attr('id') + ' input[type=text]';

}

}

}

});

prm.add_endRequest(function(source, args) {

if (focusedElementSelector) {

$(focusedElementSelector).focus();

}

});

});

</script>

<div id="divContent">

<asp:UpdatePanel ID="upSearch" ChildrenAsTriggers="true" UpdateMode="Conditional" runat="server">

<ContentTemplate>

<div id="divSearchHeader" class="p1 PrintList">

<asp:Label ID="lblSearch" runat="server"

style="position:absolute; left:10px; top:20px; font-weight:bold; font-size:14px;"

Text="Enter Name, ID, or SSN:"></asp:Label>

<asp:TextBox ID="txtSearch"

CssClass="TextSearch"

runat="server"

style="position:absolute; left:210px; top:18px; width:200px;"

TabIndex="1">

</asp:TextBox>

<asp:Button ID="cmdSearch"

runat="server"

CssClass="btnStd"

style="position:absolute; left:430px; top:18px; width:60px; right: 476px;"

text="Search" TabIndex="2"/>

<asp:Button ID="cmdRecallNext"

runat="server"

CssClass="btnStd"

style="position:absolute; left:510px; top:18px; width:0px;"

text="Recall Next"

TabIndex="3"

Visible="true"/>

<asp:Button ID="cmdRecallPrev"

runat="server"

CssClass="btnStd"

style="position:absolute; left:510px; top:18px; width:0px;"

text="Recall Previous"

TabIndex="4"

Visible="true"/>

<asp:Label ID="lblErrorMessage" runat="server" CssClass="StdErrorMsg"

style="position:absolute; left:500px; top:20px; width:478px"></asp:Label>

<!-- added the following text box to stop the jscript runtime error when hitting the Enter button to do the search -->

<asp:TextBox ID="txtBoxFixEnterError" runat="server" style="position:absolute; left:0px; top:0px; width:10px; display:none;"></asp:TextBox>

</div> <!-- divSearchHeader -->

<div id="divSearchResults" class="p1 PrintList" style="width:100%;background:#fff5ee;">

<ig:WebDataGrid ID="wdgResults"

runat="server" Height="100%"

AutoGenerateColumns="False"

StyleSetName="Nautilus"

Width="100%"

StyleSetPath="~/ig_res/Styles_2019_1"

EnableDataViewState="false"

AjaxIndicator-ImageUrl="~/images/Loading.gif"

AjaxIndicator-Location="MiddleCenter"

AjaxIndicator-Enabled="False">

<Columns>

<ig:TemplateDataField Key="Select" Width="60px">

<Header Text="Select"/>

<ItemTemplate>

<asp:LinkButton

ID="lnkSelect"

runat="server"

CausesValidation="False"

CommandName="Select"

OnPreRender="addTrigger_PreRender"

OnCommand="SelectMember"

Text="Select">

</asp:LinkButton>

</ItemTemplate>

</ig:TemplateDataField>

</Columns>

<Behaviors>

<ig:Paging PageSize="12"

QuickPages="2"

PagerMode="NumericFirstLast"

PagerAppearance="Bottom"

Enabled="true">

<PagerTemplate>

<uc1:ucCustomPager ID="ucCustomPager1" runat="server"/>

</PagerTemplate>

</ig:Paging>

<ig:Selection CellClickAction="Row" CellSelectType="None"

RowSelectType="Single">

<AutoPostBackFlags RowSelectionChanged="False" />

</ig:Selection>

<ig:RowSelectors></ig:RowSelectors>

<ig:Sorting Enabled="true"

SortingMode="Single"

AscendingImageUrl="~/Images/SortAsc.gif"

DescendingImageUrl="~/Images/SortDesc.gif">

</ig:Sorting>

</Behaviors>

</ig:WebDataGrid>

</div> <!-- divSearchResults -->

</ContentTemplate>

</asp:UpdatePanel>

</div> <!-- divContent -->

</asp:Content>

Imports Infragistics.Web.UI.ListControls
Imports Infragistics.Web.UI.GridControls
Imports BICC.BFAS.MemberBL
Partial Class Members_SearchResults
    Inherits System.Web.UI.Page
    Private marlDataRows As ArrayList
    Private mblMS As MemberSearch
    Private _customPager As ucCustomPager
    ' Page
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        _customPager = DirectCast(Me.wdgResults.Behaviors.Paging.PagerTemplateContainerBottom.FindControl("ucCustomPager1"), ucCustomPager)
        AddHandler Me._customPager.PageChanged, AddressOf _customPager_PageChanged
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddHandler Master.ToolbarClick, AddressOf Toolbar_Clicked
        MySession.CheckTimeout()
        ' Restore Member Search Object if it exists.
        If IsNothing(MySession.MemberSearchObject) Then
            mblMS = New MemberSearch(MySession.cnnDB, MySession.DBSchema)        ' initialize member object        
        Else
            mblMS = MySession.MemberSearchObject
        End If
        If Page.IsPostBack Then
            ' Restore Search Results
            marlDataRows = mblMS.SearchResults
            wdgResults.DataSource = marlDataRows
        Else
            InitForm()
            BuildGrid()
            Search(mblMS.SearchValue)
            SetPagerInfo()
        End If
        SetupRecallForPartialPostBack()
        Me.Page.Form.Attributes.Add("onkeydown", "javascript:return clickRecall(event);")
    End Sub
    Protected Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error
        Dim ex As Exception
        ex = Server.GetLastError
        LibProcs.HandleSYSError(ex)
    End Sub
    Private Sub InitForm()
        Const PensionMemberSearch As String = "PENSION MEMBER SEARCH"
        Const PensionInquiry As String = "PENSION HISTORY INQUIRY SEARCH"
        Const PensionMaintenance As String = "PENSION HISTORY MAINTENANCE SEARCH"
        Const PensionAdj As String = "PENSION ADJUDICATION SEARCH"
        Dim CurrentForm As String
        CurrentForm = Request.ServerVariables(Constants.URL).ToString       ' current page url
        MySession.STS_PreviousForm = MySession.STS_CallingForm
        MySession.STS_CallingForm = CurrentForm
        Select Case MySession.STS_InquiryPath
            Case InquiryPath.Pension
                Select Case MySession.GetLastFunction
                    Case Functions.SearchMember
                        Master.ScreenName = PensionMemberSearch
                    Case Functions.SearchPensionHistory
                        If MySession.STS_EditMode = Constants.EditMode Then
                            Master.ScreenName = PensionMaintenance
                        Else
                            Master.ScreenName = PensionInquiry
                        End If
                    Case Functions.SearchAdjudication
                        Master.ScreenName = PensionAdj
                End Select
            Case Else
                Master.ScreenName = PensionMemberSearch                ' Default
        End Select
        BuildToolbar()
        txtSearch.Focus()
    End Sub
    ' Toolbar
    Private Sub BuildToolbar()
        Dim ivtoolbar As New WebImageViewer
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/Tlbr_Back.jpg", "BUTTON1", True))
        Select Case MySession.STS_InquiryPath
            Case InquiryPath.Pension
                If MySession.IsActiveFunction(Functions.SearchMember) And MySession.STS_EditMode = Constants.EditMode Then
                    ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_ADD.jpg", "BUTTON2", True))
                Else
                    ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON2"))
                End If
            Case Else
                ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON2"))
        End Select
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON3"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON4"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON5"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON6"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON7"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON8"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON9"))
        ivtoolbar.Items.Add(LibFuncs.CreateToolbarImage("~/Images/TLBR_Blank.jpg", "BUTTON10"))
        Master.SetToolBar(ivtoolbar.Items)
    End Sub
    Private Sub Toolbar_Clicked(ByRef MPToolbar As WebImageViewer, ByVal ButtonPos As Integer, ByVal ButtonIdx As Integer)
        Select Case ButtonPos
            Case 1
                Response.Redirect(Screens.MemberSearch, False)
            Case 2  ' Add Member
                Select Case True
                    Case MySession.IsActiveFunction(Functions.SearchMember)
                        MySession.BeginFunction(Functions.AddMember)
                        Response.Redirect(Screens.MemberMaintenance, False)
                    Case Else
                        ' No Action
                End Select
        End Select
    End Sub
    ' Search Results
    Private Sub BuildGrid()
        Dim dgbfTemp As New Infragistics.Web.UI.GridControls.BoundDataField
        Dim dgcSelect As New Infragistics.Web.UI.GridControls.GridField
        Dim lctlSSN As New LiteralControl("SSN <img src='../Images/Sortable.gif' style='width:8px;'/>")
        Dim lctlEmployee As New LiteralControl("Member <img src='../Images/Sortable.gif' style='width:8px;'/>")
        Dim lctlMemberID As New LiteralControl("ID <img src='../Images/Sortable.gif' style='width:8px;'/>")
        Dim lctlCity As New LiteralControl("City <img src='../Images/Sortable.gif' style='width:8px;'/>")
        Dim lctlState As New LiteralControl("State <img src='../Images/Sortable.gif' style='width:8px;'/>")
        Dim lctlDOB As New LiteralControl("DOB <img src='../Images/Sortable.gif' style='width:8px;'/>")
        ' Set Grid Options
        wdgResults.AutoGenerateColumns = False
        wdgResults.Behaviors.Paging.PageSize = 13
        wdgResults.Width = Unit.Percentage(100)
        ' Select            Column 0
        wdgResults.Columns("Select").Width = Unit.Pixel(50)
        ' SSN               Column 1
        With dgbfTemp
            .Key = "SSN"
            .DataFieldName = "SSN"
            .DataType = "System.String"
            .DataFormatString = "{0:000-00-0000}"
            .Hidden = False
            .Width = Unit.Pixel(90)
            .Header.Text = "SSN"
            .Header.TemplateContainer.Controls.Add(lctlSSN)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' Employee          Column 2
        dgbfTemp = New Infragistics.Web.UI.GridControls.BoundDataField
        With dgbfTemp
            .Key = "Employee"
            .DataFieldName = "Employee"
            .DataType = "System.String"
            .Hidden = False
            .Width = Unit.Pixel(225)
            .Header.Text = "Member"
            .Header.TemplateContainer.Controls.Add(lctlEmployee)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' Member ID         Column 3
        dgbfTemp = New Infragistics.Web.UI.GridControls.BoundDataField
        With dgbfTemp
            .Key = "MemberID"
            .DataFieldName = "MemberID"
            .DataType = "System.String"
            .DataFormatString = ""
            .Hidden = False
            .Width = Unit.Pixel(100)
            .Header.Text = "ID"
            .Header.TemplateContainer.Controls.Add(lctlMemberID)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' City              Column 4
        dgbfTemp = New Infragistics.Web.UI.GridControls.BoundDataField
        With dgbfTemp
            .Key = "City"
            .DataFieldName = "City"
            .DataType = "System.String"
            .DataFormatString = ""
            .Hidden = False
            .Width = Unit.Pixel(200)
            .Header.Text = "City"
            .Header.TemplateContainer.Controls.Add(lctlCity)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' State             Column 5
        dgbfTemp = New Infragistics.Web.UI.GridControls.BoundDataField
        With dgbfTemp
            .Key = "State"
            .DataFieldName = "State"
            .DataType = "System.String"
            .DataFormatString = ""
            .Hidden = False
            .Width = Unit.Pixel(50)
            .Header.Text = "State"
            .Header.TemplateContainer.Controls.Add(lctlState)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' Date of Birth     Column 6
        dgbfTemp = New Infragistics.Web.UI.GridControls.BoundDataField
        With dgbfTemp
            .Key = "DOB"
            .DataFieldName = "DOB"
            .DataType = "System.DateTime"
            .DataFormatString = "{0:MM/dd/yyyy}"
            .Hidden = False
            .Width = Unit.Pixel(100)
            .Header.Text = "DOB"
            .Header.TemplateContainer.Controls.Add(lctlDOB)
        End With
        wdgResults.Columns.Add(dgbfTemp)
        ' Designate Unsortable Columns
        Dim scs1 As New Infragistics.Web.UI.GridControls.SortingColumnSetting
        scs1.ColumnKey = "Select"
        scs1.Sortable = False
        wdgResults.Behaviors.Sorting.ColumnSettings.Add(scs1)
    End Sub
    Protected Sub Search(ByVal pSearchValue As String)
        marlDataRows = mblMS.Search(pSearchValue)
        ' Adjust Name
        For i As Integer = 0 To marlDataRows.Count - 1
            marlDataRows(i).Employee() = LibFuncs.ConvertNameLFtoLF(marlDataRows(i).Employee())
        Next
        wdgResults.DataSource = marlDataRows
        mblMS.SearchResults = marlDataRows
        MySession.MemberSearchObject = mblMS             ' Save MemberSearch Object to Session
    End Sub
    Protected Sub SelectMember(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
        Dim intSSN As Integer
        Dim blM As Member
        ' Determine selected row.
        If wdgResults.Behaviors.Selection.Index > -1 Then
            intSSN = Convert.ToInt32(wdgResults.Behaviors.Selection.SelectedRows.Item(0).Items(1).Value)
        Else
            ' Nothing selected
            GoTo Exit_SelectMember
        End If
        blM = New Member(MySession.cnnDB, MySession.DBSchema, MySession.DBSchema_Employer, MySession.DBSchema_Payroll)
        blM.GetMember(intSSN)
        MySession.MemberObject = blM
        MySession.AddRecallItem(LibFuncs.DisplaySSN(intSSN.ToString))                   ' Save SSN.
        Select Case MySession.STS_InquiryPath
            Case InquiryPath.Pension
                Select Case True
                    Case MySession.IsActiveFunction(Functions.SearchMember)
                        If MySession.STS_EditMode = Constants.EditMode Then
                            MySession.BeginFunction(Functions.EditMember)
                        Else
                            MySession.BeginFunction(Functions.ViewMember)
                        End If
                        Response.Redirect(Screens.MemberMaintenance, False)
                    Case MySession.IsActiveFunction(Functions.SearchPensionHistory)
                        If MySession.STS_EditMode = Constants.EditMode Then
                            MySession.BeginFunction(Functions.EditPensionHistory)
                        Else
                            MySession.BeginFunction(Functions.ViewPensionHistory)
                        End If
                        Response.Redirect(Screens.PensionHistory, False)
                    Case MySession.IsActiveFunction(Functions.SearchAdjudication)
                        MySession.BeginFunction(Functions.PensionAdjudication)
                        Response.Redirect(Screens.PensionSelect)
                End Select
        End Select
Exit_SelectMember:
        Exit Sub
    End Sub
    Protected Sub addTrigger_PreRender(ByVal sender As Object, ByVal e As EventArgs)
        Dim btnSelect As LinkButton = TryCast(sender, LinkButton)
        Dim NewScriptManager As ScriptManager = DirectCast(Master.FindControl("ScriptManager1"), ScriptManager)
        NewScriptManager.RegisterPostBackControl(btnSelect)
    End Sub
    Private Sub ClearResults()
        marlDataRows.Clear()
        wdgResults.Rows.Clear()
        wdgResults.Behaviors.Paging.PageIndex = 0
        wdgResults.Behaviors.Selection.SelectedRows.Clear()
    End Sub
    Protected Sub wdgResults_ColumnSorted(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.SortingEventArgs) Handles wdgResults.ColumnSorted
        ResetPager()
    End Sub
    Protected Sub wdgResults_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowEventArgs) Handles wdgResults.InitializeRow
        ' Date of Birth
        If e.Row.Items(6).Value = "01/01/0001" Then
            e.Row.Items(6).Text = ""
        End If
    End Sub
    Protected Sub cmdSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
        Dim strSearchValue As String
        strSearchValue = txtSearch.Text.Trim.ToUpper
        ClearResults()
        If strSearchValue.Trim.Length = 0 Then
            lblErrorMessage.Text = "A Name, Member ID Number or Social Security Number is required."
            lblErrorMessage.Visible = True
        Else
            lblErrorMessage.Visible = False
            If IsNumeric(Left(strSearchValue, 1)) Then
                strSearchValue = Replace(strSearchValue, "-", "")                       ' Remove dashes in the SSN if present.
            End If
            mblMS.SearchValue = strSearchValue                               ' 12/30/2009 - Remember Search Argument
            Search(strSearchValue)
            SetPagerInfo()
        End If
    End Sub
    Protected Sub cmdRecallNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdRecallNext.Click
        ' Get Next Recall Item.
        txtSearch.Text = MySession.GetRecallItem
    End Sub
    Protected Sub cmdRecallPrev_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdRecallPrev.Click
        ' Get Previous Recall Item.
        txtSearch.Text = MySession.GetRecallItem
    End Sub
    Protected Sub SetupRecallForPartialPostBack()
        Dim NewScriptManager As ScriptManager = DirectCast(Master.FindControl("ScriptManager1"), ScriptManager)
        NewScriptManager.RegisterAsyncPostBackControl(cmdRecallNext)
        NewScriptManager.RegisterAsyncPostBackControl(cmdRecallPrev)
    End Sub
    ' Pager Routines
    Private Sub SetPagerInfo()
        If marlDataRows.Count > wdgResults.Behaviors.Paging.PageSize Then
            Me.wdgResults.Behaviors.Paging.Enabled = True
            Me._customPager.SetContext(marlDataRows.Count, wdgResults.Behaviors.Paging.PageSize)
        Else
            Me.wdgResults.Behaviors.Paging.Enabled = False
        End If
    End Sub
    Private Sub _customPager_PageChanged(ByVal sender As Object, ByVal e As PageSettingsChangedEventArgs)
        If (e.TotalNumberOfPages - 1) < e.PageIndex Then
            Me.wdgResults.Behaviors.Paging.PageIndex = 0
        Else
            Me.wdgResults.Behaviors.Paging.PageIndex = e.PageIndex
        End If
    End Sub
    Protected Sub ResetPager()
        wdgResults.Behaviors.Paging.PageIndex = 0
        SetPagerInfo()
    End Sub
End Class

  • 300
    Offline posted

    Hello Anna,

    Thank you for posting in our community.

    I will need some time to investigate your query. I will update you with my progress as soon as possible.

  • 300
    Offline posted

    Hello Anna,

    While trying to replicate the behavior on my side I tried creating working sample with the provided source code (having a working sample is the best approach for finding the root cause of the behavior). However, there are a lot of missing components (Does the Search method of MemberSearch class return data? ), which prevents me from running the sample. Can you please modify the sample I started so that it replicates the issue on your side?

    Having a working sample on my side is going to be highly appreciated and will help me find the root cause of the behavior.

    Looking forward to hearing from you.

    8713.Sample.zip