Firstly I would refactor out your code a bit.
I would create a method called "RetrieveQuestion" that accepts an integer to indicate which question it is getting.
int RetrieveQuestion(int questionNumber)
{
SqlConnection con1 = new SqlConnection(connection);
con1.Open();
SqlCommand cmd = new SqlCommand("Select * from quiz1 where id=" + questionNumber + " ", con1);
SqlDataAdapter data = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
data.Fill(ds);
DataView dv = ds.Tables[0].DefaultView;
if (dv.Count > 0)
{
string id = dv[0]["id"].ToString();
string question1 = dv[0]["question"].ToString();
string c1 = dv[0]["c1"].ToString();
string c2 = dv[0]["c2"].ToString();
string c3 = dv[0]["c3"].ToString();
question.Text =question1;
RadioButton1.Text = c1;
RadioButton2.Text = c2;
RadioButton3.Text = c3;
return questionNumber +1;
}
return questionNumber;
}
Then in the Next button event I would have:
protected void next_Click(object sender, EventArgs e)
{
i = RetrieveQuestion(i);
}
and, because RetrieveQuestion returns i+1 in the Previous Button event I would have:
protected void previous_Click(object sender, EventArgs e)
{
i = RetrieveQuestion(i-2);
}
This is because i is currently the next question, not the current question.