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.
问问题
1110 次
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.
您需要double.Parse()
像这样解析值:
var value = double.Parse(txtCost.Text);
尽管解析数值有一些全球化警告(比如它如何解析点和逗号)。您可以在MSDN上阅读有关 parse 方法的更多信息
Double val=Convert.ToDouble(txtCost.Text);