This is my code for searching
public ActionResult Searchproduct(string search)
{
if (search == "StockNo")
{
return View(db.ProductsHondaofConyers.Where(x => x.StockNo == search).ToList());
}
else
{
return View("Searchproduct");
}
}
VIEW:
@using (Html.BeginForm("Searchproduct","Hondaofconyers",FormMethod.Get))
{
@Html.RadioButton("id","StockNo",true)<text>StockNo</text>
@Html.TextBox("search")<input type="submit" value="search"/>
}
</p>
I am getting an error like this
ERROR:
An exception of type 'System.NullReferenceException' occurred in App_Web_mrlgxop0.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.