One of our http://www.dotnetcurry.com/ authors Malcolm Sheridan informed me that when he is replying to a viewer who has left comments and enters text in the Comment field, he can't hit the enter key to start a new paragraph or a new line because doing so causes a postback in FireFox. The Comment field happens to be a Multiline TextBox and the issue is seen in the FireFox browser.
Well if you are facing a similar issue and are looking out for a solution, here it is.
<asp:TextBox ID="txtBody" onkeypress="event.cancelBubble=true;"
runat="server" Text='<%# Bind("Body") %>' TextMode="MultiLine"
Rows="5" Width="100%"></asp:TextBox>
Observe how I have used event.cancelBubble=true on the keypress event. This property determines whether the current event should bubble up the hierarchy of event handlers. Setting it to true disables bubbling for the event and does not cause a postback when the Enter key is pressed.
Read more on the cancelBubble Property over here
Tweet
1 comment:
Just know it now that there is a property called cancelbubble....
Thx for the info....
Post a Comment