Imports System.Data Partial Class LookupProducts Inherits System.Web.UI.UserControl Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ' Instanciate the eRaceSystem Dim SystemManager As New eRaceSystem.eRace ' Retrieve and sort the Categories Dim CategoryList As DataSet CategoryList = SystemManager.LookupAllCategories CategoryList.Tables("CategoryInfo").DefaultView.Sort = "Description ASC" ' Build Our Category DropDown DD_CategoryId.DataSource = CategoryList.Tables("CategoryInfo") DD_CategoryId.DataTextField = "Description" DD_CategoryId.DataValueField = "CategoryId" DD_CategoryId.DataBind() DD_CategoryId.SelectedIndex = -1 End If End Sub Protected Sub BT_Search_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BT_Search.Click 'If Not IsJobCodeSearchValid() Then ' Display the Errors 'DisplayError() 'Else ' Instanciate the eRaceSystem Dim WebServiceMgr As New localhost.Service ' Create an new DataSet Dim ProductDS As New DataSet Try ' Get the Employees ProductDS = WebServiceMgr.AvailableProducts(Integer.Parse(DD_CategoryId.SelectedValue)) ' Check for Employees If ProductDS.Tables(0).Rows.Count() = 0 Then 'AddError("No Employees with the Job Code " + DD_SearchJobCode.SelectedItem.Text + " exist") 'DisplayError() Else ' Sort the Result 'ProductDS.Tables("ProductInfo").DefaultView.Sort = "Description ASC" ' Load the GridView ProductDS.Tables(0).DefaultView.Sort = "productId ASC" GV_Products.DataSource = ProductDS.Tables(0) GV_Products.DataBind() GV_Products.PageIndex = 0 ViewState("ProductInfo") = ProductDS 'GV_Products.DataSource = ProductDS.Tables("ProductInfo") 'GV_Products.DataBind() 'MV_Employee.SetActiveView(VW_ManageEmployees) End If Catch ex As Exception 'AddError(ex.Message) 'DisplayError() End Try 'End If End Sub End Class