How can I search data in a grid view based on the value selected from a drop down list in asp.net MVC architecture? Please see code below:
List<SelectListItem> monthlist = new List<SelectListItem>();
monthlist.Add(new SelectListItem { Text = "Select Month", Value = "0" });
monthlist.Add(new SelectListItem { Text = "1", Value = "1" });
monthlist.Add(new SelectListItem { Text = "2", Value = "2" });
monthlist.Add(new SelectListItem { Text = "3", Value = "3" });
monthlist.Add(new SelectListItem { Text = "4", Value = "4" });
monthlist.Add(new SelectListItem { Text = "5", Value = "5" });
monthlist.Add(new SelectListItem { Text = "6", Value = "6" });
monthlist.Add(new SelectListItem { Text = "7", Value = "7" });
monthlist.Add(new SelectListItem { Text = "8", Value = "8" });
monthlist.Add(new SelectListItem { Text = "9", Value = "9" });
monthlist.Add(new SelectListItem { Text = "10", Value = "10" });
monthlist.Add(new SelectListItem { Text = "11", Value = "11" });
monthlist.Add(new SelectListItem { Text = "12", Value = "12" });
ViewBag.month = monthlist;
List<SelectListItem> yearlist = new List<SelectListItem>();
yearlist.Add(new SelectListItem { Text = "Select Year", Value = "0" });
yearlist.Add(new SelectListItem { Text = "2010", Value = "1" });
yearlist.Add(new SelectListItem { Text = "2011", Value = "2" });
yearlist.Add(new SelectListItem { Text = "2012", Value = "3" });
yearlist.Add(new SelectListItem { Text = "2013", Value = "4" });
yearlist.Add(new SelectListItem { Text = "2014", Value = "5" });
yearlist.Add(new SelectListItem { Text = "2015", Value = "6" });
yearlist.Add(new SelectListItem { Text = "2016", Value = "7" });
yearlist.Add(new SelectListItem { Text = "2017", Value = "8" });
yearlist.Add(new SelectListItem { Text = "2018", Value = "9" });
yearlist.Add(new SelectListItem { Text = "2019", Value = "10" });
yearlist.Add(new SelectListItem { Text = "2020", Value = "11" });