Hi
The below code its working fine with me to sort the car brand and the Gear, but also i have two dropdownlists (DropDownList3 , DropDownList6) which is allow user to choose the car year made from a column in database table called Year, for example: from 2008 to 2012. so how i can update my code below to get the selected value from this two dropdownlist and gives the records between this two selected values
i have upload a screen record i wish that will explain more about what i am looking for:
https://www.youtube.com/watch?v=nh5fbBuUeOE&feature=youtu.be
protected void Sortcarbtn_Click(object sender, EventArgs e)
{
if (Session["location"] != null)
{
using (SqlConnection CarsortCon = new SqlConnection(cs))
{
CarsortCon.Open();
using (var CarsortQ = new SqlDataAdapter(@"SELECT DISTINCT AdsID, Section, Category, Year, Country, State, City, AdsTit, Maker,Gear,
SUBSTRING(AdsDesc,1,155) as AdsDesc, AdsPrice, Img1 FROM ads WHERE Category = @Category AND Country = @Country AND Maker=@brand AND Gear=@G", cs))
{
var location = Convert.ToString(Session["location"]);
var cat = Convert.ToString(Request.QueryString["cat"]);
var CarsortDS = new DataSet();
CarsortQ.SelectCommand.Parameters.AddWithValue("@Category", cat);
CarsortQ.SelectCommand.Parameters.AddWithValue("@Country", location);
CarsortQ.SelectCommand.Parameters.AddWithValue("@brand", catcardrlst.SelectedValue);
CarsortQ.SelectCommand.Parameters.AddWithValue("@G", DropDownList1.SelectedValue);
CarsortQ.Fill(CarsortDS);
cateshowlistview.DataSource = CarsortDS.Tables[0];
cateshowlistview.DataBind();
}
}
}