Anyone who has read these two blog posts will know that after all the options are selected, the exam will be handed in again and the exam will be closed.
Http://www.cnblogs.com/insus/p/3193619.html
Http://www.cnblogs.com/insus/p/3197194.html
Now Insus. NET implements the other method, that is, when each option is selected, it is updated to the database in real time, can solve the problem of accidentally closing the web page, When you log on again, you can see that no submitted exam, the answer already saved in the database is not made in white. When the user finally handed in the paper, click the button to close the file.
When you re-open the closed exam or make corrections, you should display the choices selected by the examiner.
Okay, the problem is clear. Insus. NET uses the All-in-One method this time. Remove the user control. All functions are implemented on the web page.
The database still uses the database in the previous example. There is a program in which categorySingleChoose. csAndTest. csUnchanged.
In the site, create a webpage and create a Repeater control in the webpage:
Because it is All-in-On, we can see that the highlighted html is directly a RadioButtonList control. Now you need to bind data to the Repeater control and write the program to. aspx. cs:
Next, bind the option to the RadioButtonList control in the Repeater control. First, add an OnItemDataBound event to the Repeater control:
Before binding option data, instantiate the object SingleChoose objSingleChoose = new SingleChoose ();
After data binding is complete, we need to update the database immediately when the examinee clicks the option. Therefore, you need to implement the SelectedIndexChanged event for the RadioButtonList control, or set the property AutoPostBack to true for the RadioButtonList control. In this way, the RadioButtonList will be updated on the server every time.
Go to the Repeater control of the. aspx web page and add another event OnItemCreated:
Go to. aspx. cs to write the logic code of the above event:
One event delegates the rbl_SelectedIndexChanged event, finds the record primary key, and updates the database.
In the animation demonstration, the storage options are displayed.
rbl.SelectedValue = DataBinder.Eval(e.Item.DataItem, ).ToString();