中国搜 程序源代码学习 编程源代码 直接应用在编程实践中 优秀编程书籍源码欣赏

收藏本页到>> 新浪ViVi  365Key网摘   IE收藏夹 |设为首页

 中国搜首页 >>ASP.NET相关>>HTML内容的操纵 C#版

代码说明:
     页面中静态部分是通过无格式的HTML标记和文本来构建的。页面中的HTML内容是通过Literal Control类来实现的。可以使用LiteralContol类的Text属性来操作ASP.NET页面中的纯HTML部分。
    下面的代码在Page_Load子程序遍历了页面中的所有控件(包括Literal Control),并且颠倒了每个控件的Text属性的值。

<Script Runat="Server">

Sub Page_Load
Dim litControl As LiteralControl

For each litControl in Page.Controls
litControl.Text = strReverse( litControl.Text )
Next
End Sub

</Script>

<html>
<head><title>Literal.aspx</title></head>
<body>

<b>This text is reversed</b>

</body>
</html>

   运行演示程序   

  ©2004   www.zhonguosou.com