Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

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

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

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


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

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

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

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

</table>


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
Posted
Updated 22-May-11 21:42pm
v2

1 solution

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 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900