I have the following webform:
<%@ Page Language='C#' AutoEventWireup='true' CodeBehind='Default.aspx.cs' Inherits='TestWebApp.Default' %> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' > <head runat='server'> <title></title> </head> <body> <form id='form1' runat='server'> <div> <asp:TextBox ID='txtMultiLine' runat='server' Width='400px' Height='300px' TextMode='MultiLine'></asp:TextBox> <br /> <asp:Button ID='btnSubmit' runat='server' Text='Do A Postback' OnClick='btnSubmitClick' /> </div> </form> </body> </html>
and each time I post-back the leading line feeds in the textbox are being removed. Is there any way that I can prevent this behavior?
I was thinking of creating a custom-control that inherited from the textbox but I wanted to get a sanity check here first.
I ended up doing the following in the btnSubmitClick()
I must be really tired or sick or something.