Protected Sub btnFetch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFetch.Click
Dim WebServiceMgr As New localhost.theServices
Dim productInfo As DataSet
Try
productInfo = WebServiceMgr.AvailableProducts(cbCategoryList.SelectedValue)
If productInfo.Tables(0).Rows.Count = 0 Then
FormMessage.Text = "There are no products for this category: " & cbCategoryList.SelectedValue
Else
LoadGridView(productInfo)
End If
Catch ex As Exception
FormMessage.Text = ex.Message
End Try
End Sub
Private Sub LoadGridView(ByVal productInfo As DataSet)
productInfo.Tables(0).DefaultView.Sort = "productId ASC"
grdProducts.DataSource = productInfo.Tables(0)
grdProducts.DataBind()
grdProducts.PageIndex = 0
ViewState("ProductInfo") = productInfo
End Sub