Actually what i am doing here is,
I want search functionality in MVC4 with database
In my database
Tagno-----int
StockNo----Varchar in my database
I want to search data from database using Tagno or StokeNo
VIEW:
@using (Html.BeginForm("Sss","Hondaofconyers",FormMethod.Get))
{
<b>Search by</b>
@Html.RadioButton("searchBy", "TagNo", true)<text>Tagno</text>
@Html.RadioButton("searchBy", "StockNo", true)<text>StockNo</text>
<br />
@Html.TextBox("search")<input type="submit" value="Search"/>
}
CONTROLLER:
public ActionResult Sss(string searchBy,int search)
{
var styles = from s in db.ProductsHondaofConyers select s;
if (searchBy == "Gender")
return View(db.ProductsHondaofConyers.Where(x => x.TagNo == search).ToList());
else
return View(db.ProductsHondaofConyers.Where(x => x.StockNo==search).ToList());
}
Here i am using Radiobutton,Either search by Tagno or Stokeno
What is the mistake in the above my code ,
please help me,I am strocked this functionality