TextBox loses value after sending using TextMode Number

There was a strange problem. I have a simple page with a TextBox :

 <asp:ScriptManager runat="server" /> <asp:UpdatePanel runat="server"> <ContentTemplate> <asp:TextBox ID="amountTextBox" runat="server" TextMode="Number" /> <asp:Button runat="server" Text="Confirm" OnClick="confirmButton_Click" /> </ContentTemplate> </asp:UpdatePanel> 

After Button click, I will try to get the TextBox value:

 public partial class test : Page { protected void confirmButton_Click(object sender, EventArgs e) { var answer = amountTextBox.Text; } } 

but it is empty. If I remove UpdatePanel , I can get the value. If I leave the UpdatePanel and remove the TextMode property, I can get the value. But why can't I set TextBoxt from TextMode to Number in UpdatePanel ?

+4
source share
1 answer

Known issue ; Hotfix is ​​available in RTM.NET 4.5.

Description

HTML5 has new types for the input tag, such as type = "number", which requires mobile phones to display a numeric keypad instead of a text keyboard. With the full postback of the page, it works in all browsers. But if I put them in the updated panel on the website to do partical postback, then none of the new HTML input types are included in the response to the server from those browsers that understand these new types (Safari / WebKit and Opera). It works correctly in IE8 and Firefox 4, but probably only because they did not implement these new types and refuse to understand this as a type = "text" field.

Here's another question with this problem and workarounds: UpdatePanel with an input type different from the text in html5 .

+5
source

Source: https://habr.com/ru/post/1200266/


All Articles