0

Does anyone know that how to store a double type value from html textbox into a c# variable? I have a html textbox with Id txtCost and that will hold a double value. Thanks in advance.

4

2 回答 2

2

您需要double.Parse()像这样解析值:

var value = double.Parse(txtCost.Text);

尽管解析数值有一些全球化警告(比如它如何解析点和逗号)。您可以在MSDN上阅读有关 parse 方法的更多信息

于 2013-07-09T09:28:24.163 回答
0
Double val=Convert.ToDouble(txtCost.Text);
于 2013-07-09T09:31:22.633 回答