使用ASP.NET C#在运行时创建html标记 [英] Creating html tag at runtime using ASP.NET C#

查看:86
本文介绍了使用ASP.NET C#在运行时创建html标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人在这里帮助我.我有一个处理问题和答案的项目,看看进展如何:

当用户发布问题时,站点上的人会回答该问题,这意味着一个问题将有多个答案,这就是我的挑战.我的页面上有问题列表,当用户单击特定问题时,应用程序会将用户定向到另一个页面,并带出与他们单击的问题相对应的所有答案,但是我面临的挑战是如何创建HTML表数据(

)或运行时的表行,这样我就可以将不同的答案放在不同的HTML
或表行中,因为我选择了所有答案一个问题.我想在表格行
或表格数据
中显示答案页面加载问题答案时,需要为每个答案创建一个或
.

Please somebody help me here. I have a project that deals with questions and answers, see how it goes:

When a user post a question, people on the site answers the question meaning a question will have multiple answers and here is my challenges. There are list of questions on my page and when a user click on a particular question, the application directs the user to another page and brings out all the answers corresponding to the question they clicked but my challenge is how to create HTML table data(

) or table row at runtime so that I can put different answers in different HTML
or table row because i am selecting all answers for a single question. I want to display the answers in a Table Row
or Table Data
which means i will need to create a or
for each answer when the page loads the answers for a question.

Your respond will be highly appreciated.

推荐答案


根据您发布的场景,我相信您不需要动态表格来显示多个答案.简单的中继器可以更轻松地完成您的工作.如果您不太习惯使用ASP.NET转发器控件,这些文章将对您有所帮助
http://www.netrostar.com/Tutorials-91-ASP .NET%20Tutorial.%20How%20to%20use%20Repeater [ http://articles.sitepoint.com/article/asp-net-repeater-control [ ^ ]
http://www.w3schools.com/ASPNET/aspnet_repeater.asp [ http://www.asp101.com/articles/lee/multiupdate/default.asp [ ^ ]

希望这对您有帮助
Hi,
according to your posted scenario I believe you don''t need dynamic table to show multiple answers. Simple repeater will do your job with more simply. If you are not much used to with asp.net repeater control these articles will help
http://www.netrostar.com/Tutorials-91-ASP.NET%20Tutorial.%20How%20to%20use%20Repeater[^]
http://articles.sitepoint.com/article/asp-net-repeater-control[^]
http://www.w3schools.com/ASPNET/aspnet_repeater.asp[^]
http://www.asp101.com/articles/lee/multiupdate/default.asp[^]

Hope this will help


奥兰米

您使用以下代码,在运行时创建Html标记..


Hi Olammy

You use below code, create the Html Tag on run time..


Response.Write("<div><font size='2' face='Tahoma'><B>" +
                                   mydata + "</B></font></div>");


这篇关于使用ASP.NET C#在运行时创建html标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆