Online Exam Application
-
Hi, I want to create Questions on the form. Form contains 1 question at a time. I have arraylist with number of questions. From that arraylist I want to get the question and depending upon the next and prev button I want to circulate the question. How Can I Do this? Thanks
-
Hi, I want to create Questions on the form. Form contains 1 question at a time. I have arraylist with number of questions. From that arraylist I want to get the question and depending upon the next and prev button I want to circulate the question. How Can I Do this? Thanks
sjs4u wrote:
I want to create Questions on the form. Form contains 1 question at a time. I have arraylist with number of questions. From that arraylist I want to get the question and depending upon the next and prev button I want to circulate the question. How Can I Do this?
if(!ispostback) { viewstate["index"]="0"; }
On Next Button eventif (viewstate["index"].ToString()=="0") { //Get question from arraylist with 0 index int.parse(viewstate["0"]) +=1; } else { //Get question from arraylist with viewstate index number string quest=arrlist[int.parse(viewstate["index"])] //check if question is from last array index then disable next button if(int.parse(viewstate["index"])==arrlist.count){ //disable next button}else{int.parse(viewstate["0"]) +=1;} }
On Previous Button eventif (viewstate["index"].ToString()=="0") { //Get question from arraylist with 0 index //disable previous button int.parse(viewstate["0"]) +=1; } else { //Get question from arraylist with viewstate index number string quest=arrlist[int.parse(viewstate["index"])] int.parse(viewstate["0"]) -=1; }
please don't forget to vote on the post that helped you.
-
sjs4u wrote:
I want to create Questions on the form. Form contains 1 question at a time. I have arraylist with number of questions. From that arraylist I want to get the question and depending upon the next and prev button I want to circulate the question. How Can I Do this?
if(!ispostback) { viewstate["index"]="0"; }
On Next Button eventif (viewstate["index"].ToString()=="0") { //Get question from arraylist with 0 index int.parse(viewstate["0"]) +=1; } else { //Get question from arraylist with viewstate index number string quest=arrlist[int.parse(viewstate["index"])] //check if question is from last array index then disable next button if(int.parse(viewstate["index"])==arrlist.count){ //disable next button}else{int.parse(viewstate["0"]) +=1;} }
On Previous Button eventif (viewstate["index"].ToString()=="0") { //Get question from arraylist with 0 index //disable previous button int.parse(viewstate["0"]) +=1; } else { //Get question from arraylist with viewstate index number string quest=arrlist[int.parse(viewstate["index"])] int.parse(viewstate["0"]) -=1; }
please don't forget to vote on the post that helped you.