I have a huge ASPX web form which has around 100 fields which need to be input fields. This web form is an excel sheet converted into to an HTML Page.
I have marked table cells which need to be input fields with a string “txtb” (TextBox).
Once I was done with the look and feel, I tried replacing all txtb string with <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> thinking that the ID=TextBox1 will be incremented automatically by the editor itself, like TextBox2, TextBox3 and so on.
But all the replaced txtb strings show <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> only.
I know that if we copy <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> and paste manually inside the editor, the editor will increment the id by 1 for each paste.
How can I get this to happen for automatic replace? Please help.
<tr>
<td colspan="2">
txtb
</td>
<td>
txtb
</td>
<td>
txtb
</td>
<td>
txtb
</td>
</tr>
<tr>
<td colspan="2">
txtb
</td>
<td>
txtb
</td>
<td>
txtb
</td>
<td>
txtb
</td>
</tr>
It is just some huge file that looks like this. I want to replace each txtb instance with <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>, but the ID should be incremented on each replace. I wish PowerShell was installed on this machine. Otherwise I could have scripted this. Since there is not much time and no other way I can think of, I am posting here for help.
I would recommend this library and query your page for ‘txtb’ tags and replace them with textboxes. You can count the number of ‘txtb’ occurences and append them to the ID attribute of your dynamicly created textbox.
http://htmlagilitypack.codeplex.com/
See this links for some examples:
Does this help you?