Search code examples
c#asp.nethtmlstringbuilderresponse.write

HTML Code to C# StringBuilder Tool?


I used to use a tool that you type in an HTML Code lik this one:

        <div id="pnlLoggedIn" style="width:480px;">
            <label for="txtUsername">Username</label>:
            <input name="txtUsername" type="text" id="txtUsername" class="input_small" tabindex="1"> 
            &nbsp;&nbsp;&nbsp;
            <label for="txtPassword">Password</label>:
            <input name="txtPassword" type="password" id="txtPassword" class="input_small" tabindex="2"> 
            &nbsp;&nbsp;
            <input type="submit" name="cmdLogin" value="Login" id="cmdLogin" class="red-button" tabindex="3" runat="server">
        </div>

And it gives you this as output:

StringBuilder sb = new StringBuilder();
sb.AppendLine("            <div id=\"pnlLoggedIn\" style=\"width:480px;\">");
sb.AppendLine("                <label for=\"txtUsername\">Username</label>:");
sb.AppendLine("                <input name=\"txtUsername\" type=\"text\" id=\"txtUsername\" class=\"input_small\" tabindex=\"1\"> ");
sb.AppendLine("                &nbsp;&nbsp;&nbsp;");
sb.AppendLine("                <label for=\"txtPassword\">Password</label>:");
sb.AppendLine("                <input name=\"txtPassword\" type=\"password\" id=\"txtPassword\" class=\"input_small\" tabindex=\"2\"> ");
sb.AppendLine("                &nbsp;&nbsp;");
sb.AppendLine("                <input type=\"submit\" name=\"cmdLogin\" value=\"Login\" id=\"cmdLogin\" class=\"red-button\" tabindex=\"3\" runat=\"server\">");
sb.AppendLine("            </div>");
return sb.ToString();

I cant remember the name of the tool, i remember it was an online tool.

If someone knows a tool that does that can please write it here.


--UPDATE--

Here is the tool i created: C# HTML Builder


Solution

  • I made the application i needed :)

    Hope anyone else can find a use in that:

    C# HTML Builder