private void InitControls() { this.dataGridView1.Rows.Clear(); this.dataGridView1.Columns[0].Width = 250; this.dataGridView1.Columns[1].Width = 100; this.dataGridView1.Columns[2].Width = 80; this.dataGridView1.Columns[3].Width = 80; this.dataGridView1.Columns[4].Width = 80; var result = WebRequestUtil.GetBrandHome(); if (result != null) { var response = JsonUtil.Deserialize <QSWResponse <List <BrandModel> > >(result.Content); List <BrandModel> brandModelList = response.Data; foreach (var brand in brandModelList) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = brand.BrandName; this.dataGridView1.Rows[index].Cells[1].Value = brand.BrandImg; this.dataGridView1.Rows[index].Cells[2].Value = brand.OderSart; this.dataGridView1.Rows[index].Cells[3].Value = brand.BrandTypeId; this.dataGridView1.Rows[index].Cells[4].Value = brand.BrandState; this.dataGridView1.Rows[index].Tag = brand; } } }
private static List <BrandModel> getBrandModelList() { var contentResult = WebRequestUtil.GetBrandHome(); if (contentResult != null) { var response = JsonUtil.Deserialize <QSWResponse <List <BrandModel> > >(contentResult.Content); List <BrandModel> brandModelList = response.Data; return(brandModelList); } return(null); }