private void BindBrandRepeater() { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyWebsiteDB"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("select * from Tbl_Brands", con)) { using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dt = new DataTable(); sda.Fill(dt); RepeaterBrand.DataSource = dt; RepeaterBrand.DataBind(); } } } }
protected void Page_Load(object sender, EventArgs e) { RepeaterBrand.DataSource = repoBrand.GetAll().ToList(); RepeaterBrand.DataBind(); }