private void bindfunction()<br /> {<br /> int i = 0; int j=0;<br /> SqlDataAdapter da = new SqlDataAdapter(@"select distinct Sectiontype, Questiontype,Subject from dbo.tbl_QuestionConfig where Subject='C++'", con);<br /> DataTable dt = new DataTable();<br /> da.Fill(dt);<br /> if (dt.Rows.Count > 0)<br /> {<br /> for (i = 0, j = 0; i < dataRepeater1.ItemCount && j < dt.Rows.Count; i++,j++)<br /> {<br /><br /> // Label txtExample = (Label)dataRepeater1.Controls.Find("label1", true).First();<br /> //if (txtExample != null)<br /> //{<br /> SqlDataAdapter daa = new SqlDataAdapter(@"select Question,Fullmarks from dbo.tbl_QuestionConfig where Sectiontype='" + dt.Rows[i]["Sectiontype"].ToString() + "' and Questiontype='" + dt.Rows[i]["Questiontype"].ToString() + "' and Subject='" + dt.Rows[i]["Subject"].ToString() + "'", con);<br /> DataTable dtt = new DataTable();<br /> daa.Fill(dtt);<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 /> }<br /> <br /><div> }</div><div> </div><div> </div><div> frist time page load datagrid is null ?? no data found in datagrid in widows application.</div><div> </div><div> </div>