简体   繁体   English

ASP.NET动态页面生成

[英]ASP.NET Dynamic page generation

I'm developing an online survey application for my University project. 我正在为我的大学项目开发​​一个在线调查应用程序。

I managed to save the newly created survey data into the database and now the problem is that i don't know how to populate the saved questions into a page (which sent to the customer to get responses) dynamically. 我设法将新创建的调查数据保存到数据库中,现在的问题是我不知道如何动态地将保存的问题填充到页面中(该页面已发送给客户以获取响应)。 And that response data should also be saved to the database. 并且该响应数据也应保存到数据库中。

Can anyone please help me on this. 谁能帮我这个忙。 I'm using ASP.NET for this. 我为此使用ASP.NET。

Thanks 谢谢

First you need some database calls to get the questions. 首先,您需要一些数据库调用来获取问题。

  • select (id, description) from questions 从问题中选择(编号,描述)

Then you need to populate this information into a Data Control. 然后,您需要将此信息填充到数据控件中。 I suggest a DataList or Repeater. 我建议使用DataList或Repeater。

Assuming that the answers will be yes/no, you also need to add something like a RadioButtonList to collect the yes or no selection to the ItemTemplate. 假设答案为是/否,则还需要添加诸如RadioButtonList之类的内容以将Item的yes或no选择收集到。

You will need to submit the form, so a Button should be used. 您将需要提交表单,因此应使用按钮。 In the click event, loop through each row of the DataList/Repeater and gather the answers. 在click事件中,循环遍历DataList / Repeater的每一行并收集答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM