There can be various way to standardize this code..
my suggestion would be:
1. Write a function which will populate the RadioButton list.
public void FillRadioButton(RadioButtonList rbList, DataRow dr)
{
rbList.Items.Clear();
rbList.Items.Add(dr[0].ToString());
rbList.Items.Add(dr[1].ToString());
rbList.Items.Add(dr[2].ToString());
rbList.Items.Add(dr[3].ToString());
}
2. Update the foreach loop to fill the invoke this method for all the radiobutton list
for (int i = 1; i <= 25; i++)
{
SqlCommand cmd1 = new SqlCommand("select ans1,ans2,ans3,ans4,cans from questions where tname='Prelim' and questionno='" + i + "'", con);
SqlDataAdapter daa = new SqlDataAdapter(cmd1);
DataSet dss = new DataSet();
daa.Fill(dss, "questions");
DataRow DRR = dss.Tables[0].Rows[0];
RadioButtonList rbList = this.FindControl("RadioButtonList" + i.ToString()) as RadioButtonList;
FillRadioButton(rbList, DRR);
}
Hope this helps....