1

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">
        &nbsp; &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </td>
</tr>
<tr>
    <td colspan="2">
        &nbsp; &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </td>
    <td>
        &nbsp; txtb&nbsp;
    </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.

2 Answers 2

1

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:

  1. http://htmlagilitypack.codeplex.com/wikipage?title=Examples

Does this help you?

0
1

I think the editor will take care of IDs if you first replace the txtb with

<asp:TextBox id="TextBox" ... /> 

in the Excel itself and then copy/paste it into the editor.

1
  • I am sorry that did not work for me. Even if it works, this means a lot of customization with the look and feel again, which might take around couple of hours...
    – Animesh D
    Feb 7, 2012 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.