protected void btnsearch_Click(object sender, EventArgs e) { List <Armor> armorsfilter = new List <Armor>(); armors = repository.GetArmors(); if (textfilter.Text == "All" || textfilter.Text == "all") { GridViewArmors.DataSource = repository.GetArmors(); GridViewArmors.DataBind(); } else { for (int i = 0; i < armors.Count(); i++) { if (textfilter.Text == armors[i].ArmorType.ToString()) { armorsfilter.Add(armors[i]); } } GridViewArmors.DataSource = armorsfilter; GridViewArmors.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { GridViewArmors.DataSource = repository.GetArmors(); GridViewArmors.DataBind(); }