I'm working on an MVC-based inventory system that simply displays data from an SQL database. I have gotten stuck on one part however and I will pay a small amount for assistance.
My problem is that I can not display the products based on the category. I have attached a picture, please view this as it illustrates my problem. I am able to search for a products using their productID and ProductName, but I need to be able to search using '[login to view URL]'. Categories are associated to the product through a foreign key called "[login to view URL]".
I simply want to be able to select a category from a dynamic dropdownlist, and have it display the associated products(and product info).
ProductController:
public ViewResult Index(string searchString, string search1String, int categoryID)
{
var products = from p in [login to view URL]
select p;
var categories = from c in [login to view URL]
select c;
var vendors = from v in [login to view URL]
select v;
[login to view URL] = new SelectList([login to view URL], "CategoryID", "CategoryName");
[login to view URL] = new SelectList([login to view URL], "VendorID", "VendorName");
if (![login to view URL](searchString))
{
products = [login to view URL](p => [login to view URL]().Contains([login to view URL]()));
}
else if (![login to view URL](search1String))
{
products = [login to view URL](p => [login to view URL]().Contains([login to view URL]()));
}
else if ([login to view URL] == true)
{
products = [login to view URL](p => [login to view URL]().Contains([login to view URL]()));
}
return View([login to view URL]());
Index View:
Last Updated: @[login to view URL]
@using ([login to view URL]())
{
ProductID: @[login to view URL]("SearchString")
}
@using ([login to view URL]())
{
Product Name: @[login to view URL]("Search1String")
}
@using ([login to view URL]())
{
Category Name: @[login to view URL]("Search2String")
}
@using ([login to view URL]())
{
Filter by Category: @[login to view URL]("CategoryID")
}
@using ([login to view URL]())
{
Filter by Vendor: @[login to view URL]("VendorID")
}
Unfortunately I can not communicate via skype but only through email while I am at work. Also, if you are able to fix this problem I will offer you additional jobs that pop up while I'm working on this system.
I've been working with .net for over a decade and am more than certain I can help you to fix this issue very quickly. Is an error being returned or is nothing at all happening? Ship over the relevant code so I can make running sample & I'll take a closer look for you.