ASP.NET - 如何写在页面一些HTML?随着的Response.Write? [英] ASP.NET - How to write some html in the page? With Response.Write?

查看:173
本文介绍了ASP.NET - 如何写在页面一些HTML?随着的Response.Write?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在那个我编码的asp.net页面地区一些HTML,是根据一个字符串变量的变化。
我在想创建一个标签,然后改变它的文本。

I need that some html in the area in the asp.net page that i am coding, is changed according to a string variable. I was thinking about creating a label, and then change the text on it.

但字符串变量包含类似:

But the string variable contains something like:

<h2><p>Notify:</p> alert</h2>

所以,我不觉得把这个给一个标签文本是一个好主意。

So, I don't feel that give this to a label text is a good idea

我该怎么办?
使用的Response.Write?
如果我使用的Response.Write,我增加了code将在HTML源代码开始,我怎么能告诉他,将其添加在一个特定的?

How i can do? Using response.write? If I use response.write, my added code will be at the beginning of the html source, how i can tell him to add it in a specific ?

感谢您

推荐答案

你为什么不给 LiteralControl 一试?

 myLitCtrl.Text="<h2><p>Notify:</p> Alert</h2>";

这篇关于ASP.NET - 如何写在页面一些HTML?随着的Response.Write?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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