private void dataRepeater1_DrawItem(object sender, Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs e)<br /> {<br /> Label txtExample = (Label)e.DataRepeaterItem.Controls["label1"] as Label;<br /> Label label2 = (Label)e.DataRepeaterItem.Controls["label2"] as Label;<br /> Label label3 = (Label)e.DataRepeaterItem.Controls["label3"] as Label;<br /> Label label4 = (Label)e.DataRepeaterItem.Controls["label4"] as Label;<br /> var grid = e.DataRepeaterItem.Controls["dataGridView1"] as DataGridView;<br /> if (txtExample.Text != null && label2.Text != null && label3.Text != null && label4.Text != null)<br /> {<br /> SqlDataAdapter daa = new SqlDataAdapter(@"select Question,Fullmarks from dbo.tbl_QuestionConfig where Sectiontype='" + label2.Text + "' and Questiontype='" + label3.Text + "' and Subject='" + label4.Text + "'", con);<br /> DataTable dtt = new DataTable();<br /> daa.Fill(dtt);<br /> if (dtt.Rows.Count > 0)<br /> {<br /> dataGridView1.DataSource = dtt;<br /> dataGridView1.AutoGenerateColumns = false;<br /> dataGridView1.EnableHeadersVisualStyles = false;<br /> dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSeaGreen;<br /> foreach (DataGridViewRow r in dataGridView1.Rows)<br /> {<br /> r.DefaultCellStyle.BackColor = Color.LightCyan;<br /> }<br /> }<br /> }<br /><div> }</div><div> </div><div> </div><div> </div><div> </div><div> datagrid view binding error.</div>