Why do you use the StringBuilder?? Why not just :
dv.InnerHtml = "<input type="text" runat="server" name="txtName" id="txtId" />";
The StringBuilder makes no sense at all in your code.
Further more, if you just add a textbox to your page, why don't you just drag the textbox on our webform? If you want thetextbox to post to a code-behind, you may just want to always add the textbox to your page and hide it using css.
Eduard