/// <summary> Method to Bind Data into Page components. </summary> /// <returns>void.</returns> /// <param name="category"> Category Name. </param> /// <param name="searchQuery"> Serach Query. </param> private void BindData(string category, string searchQuery) { if (category == null) { if (searchQuery.Equals("")) { adpProductDetails.Fill(tblProductDetails, user.UserId); } else { tblProductDetails = adpProductDetails.SearchProducts(user.UserId, searchQuery); } } else { tblProductDetails = adpProductDetails.GetProductsByCategoryId(int.Parse(category), user.UserId); if (tblProductDetails.Count > 0) { CategoryName = tblProductDetails[0].CategoryName; } } lvProducts.DataSource = tblProductDetails; lvProducts.DataBind(); /// <summary> Array to store Product ID.</summary> string[] keyArray = { "ProductId" }; lvProducts.DataKeyNames = keyArray; //lvProducts.Data }
/// <summary> /// Method to Bind Data into Page components. /// </summary> private void BindData() { tblProductDetails = adpProductDetails.GetOwnProducts(user.UserId); lvProducts.DataSource = tblProductDetails; lvProducts.DataBind(); Cache["lvProducts"] = lvProducts; string[] keyArray = { "ProductId" }; lvProducts.DataKeyNames = keyArray; }