Posted on: 2/6/2014 2:50:26 PM | Views : 650

i have created a online exam using asp.net and C# and the Sql server 2008 databse 
i have created many number buton which access the question on base of number printed on button 
i need a loop that chek the database row always and change the button colour if the question number one ans row is blank then it show the red colour button and if the ans row is not empty then it shows green button i am using a code but it is very lengthy please suggest how i can use this in short..
SqlDataAdapter dares = new SqlDataAdapter("select * from " + username.Text + "", cn); DataSet dsres = new DataSet(); dares.Fill(dsres, username.Text); if (dsres.Tables[0].Rows[0][1].ToString().Trim() == "") { Button1.BackColor = System.Drawing.Color.PaleVioletRed; } else { Button1.BackColor = System.Drawing.Color.LimeGreen; ...

Go to the complete details ...