Got weird problem. I have simple page with 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 try to get TextBox
value:
public partial class test : Page {
protected void confirmButton_Click(object sender, EventArgs e) {
var answer = amountTextBox.Text;
}
}
but it's empty. If I remove UpdatePanel
, I manage to get the value. If I leave UpdatePanel
and remove TextMode
property, I manage to get the value. But why can't I have TextBoxt
with TextMode
set to Number
in UpdatePanel
?
It is a known issue, a fix is available in .NET 4.5 RTM.
Description
Here is another question with this issue and workarounds: UpdatePanel with input type other than text in html5.