动态HTML置于静态控件上 [英] Dynamic HTML Put on static controls

查看:100
本文介绍了动态HTML置于静态控件上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我有一个aspx网页,其中包含两个文本框,即

Dear All,

I have an aspx web page contain two text boxes i.e

<asp:TextBox ID="txtID" runat="server">

<asp:TextBox ID="txtName" runat="server">



我在数据库中有HTML,并且在任何事件(即int,preint或load)下都可以在cs文件中检索它. HTML就像下面的



I have HTML in data base and i retrieve it in cs file at any event(i.e int, preint or load). The HTML is like following

 <table style=" width:50%; background-color:lightGray;">

       <tr><td></td> <td>[txtID]</td></tr>

       <tr><td></td><td>[txtName]</td></tr>

</table>



现在我想将[txtID]替换为<asp:TextBox ID="txtID" runat="server">

[txtName]<asp:TextBox ID="txtName" runat="server">

简而言之,我想更改静态控件的HTML.除控件外,aspx页面上没有一行HTML.

提出您的想法,

谢谢



Now I want to replace [txtID] with <asp:TextBox ID="txtID" runat="server">

and [txtName] with <asp:TextBox ID="txtName" runat="server">

In simple words, I want to change HTML of static controls. There is no single line of HTML on aspx page except controls.

Give your ideas,

Thanks

推荐答案

法比奥,
简单的方法就是使用.replace()函数以多种方式完成此操作.
只需将"["替换为< asp:TextBox ID =",将"]替换为""runat =" server>"用/:)照顾双层大衣


另一种方法是使用Parser类,您可以在Google中轻松找到它:)


让我知道您是否需要任何澄清...

享受生活:)
HI Fabio,
This can be done in lots of ways the simple one is use .replace() function
just replace "[" with " <asp:TextBox ID="" and "]" with " "runat="server">" take care of double coats by / :)


The other method is using Parser class you can find in google easily :)


Let me know if you need any clarification......

Enjoy Life :)


这篇关于动态HTML置于静态控件上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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