private void BindProductsRepeater()
{
String CS = System.Configuration.ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
using (SqlCommand cmd = new SqlCommand("procBindAllProducts", con))
{
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
rptrProducts.DataSource = dt;
rptrProducts.DataBind();
}
}
}
}
I have this method which bind items to my repeater via OnItemBound, works perfectly fine. It display product details, title, price, image, I want to create a function where I can order the items by price via sql command. I'm just at wits end on how to do this.