0

私はasp.netでオンラインテストアプリケーションに取り組んでおり、チェック済みの回答ステータスをデータベースに保存する際に問題が発生しています。つまり、aspxページの次のボタンをクリックすると、これら2つのことが起こるはずです

1)現在チェックされているオプションをキャプチャし、その特定のオプションの値をtrueとしてデータベースのIS_Marked列に追加する必要があります。

2)次の質問とオプションのセットも引き出す​​必要があります

後者は問題ありませんが、チェックされた回答をデータベースに保存する方法についての手がかりがありません

私のaspxには4つのチェックボックスがあります

私の次のボタンクリックイベントは次のとおりです。

protected void BtnNext_Click(オブジェクト送信者, EventArgs e)

{

if (qid == maxid)// 現在のキュー ID が DB の最後のキュー ID と等しいかどうかをチェックします

{
     BtnNext.Enabled = false; //if its last que then next button is disabled
}
else
{      
     BtnPrevious.Enabled = true; // if not last question next button is enabled

     QuestionSet q = new QuestionSet();  //Question set is an entity to hold que text and options list
     StudentB b = new StudentB(); //object of my business class
     q = b.GetQuestion(1, 1, qid, 'N', 0);//passing student id, test id, question id, action taken, i.e button clicked(prev, next, last, first) and selected question(i.e any question that is present)
     qid = Convert.ToInt32(q.Question_Id);

     LblQStn.Text = q.Question_Text;
     CheckBox1.Text = q.Options[0].Option_Text;//talking to business and model layer and getting que and ans from database and giving to checkboxes
     CheckBox2.Text = q.Options[1].Option_Text;
     CheckBox3.Text = q.Options[2].Option_Text;
     CheckBox4.Text = q.Options[3].Option_Text;
    }
}

今、彼が回答をチェックしたら、データベースにマークされたステータスを保存する必要があります。

前もって感謝します

4

1 に答える 1