- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
在 Page1.aspx 上,我有 3 个带有比较验证器的 txtBox,以确保它们是货币类型。
在 Page2.aspx 上,我有另一个名为 txtResult 的文本框,当在 Page1 上单击 btnCalculate 时,它的工作是显示其他 3 个 txtBoxes 的总和。
问题:我无法将 3 个 txtBox 视为 double 而不是字符串。如果 txtBox 值为 1、3 和 8,txtResult 将为 138 而不是 12。
我试过尝试解析,但不允许编译失败。
Page1 背后的代码:
protected void btnCalculate_Click(object sender, EventArgs e)
{
if (IsValid)
{
Server.Transfer("Page2.aspx");
}
}
Page2 背后的代码:
if (!IsPostBack)
{
Page lastPage = (Page)Context.Handler;
txtResult.Text = ((TextBox)lastPage.FindControl("txtGross")).Text
+ ((TextBox)lastPage.FindControl("txtValueOfAssets")).Text
+ ((TextBox)lastPage.FindControl("txtInvestments")).Text;
}
尝试使用TryParse
:
txtResult.Text =
double.TryParse(((TextBox)lastPage.FindControl("txtGross")).Text, out gross);
错误:
Cannot implicitly covert bool to string
这个问题在这里已经有了答案: Converting string to double in C# (5 个答案) 关闭 6 年前。 在 Page1.aspx 上,我有 3 个带有比较验证器的 txt
我想写一个简单的“注册/登录”程序,只是为了我,只是为了好玩。 我想更改用户键入姓名的 TxtBox 的颜色。当txtBox.Length<4它应该将其背景更改为红色。 我不知道为什么我的下面的代码不
我问你以下问题我必须确保基于组合框的值的选择一些文本框/一些按钮被禁用..在论坛上我找到了这个解决方案但它不起作用...... Enable an HTML form text box based o
编程不远,刚刚加入这个强大公司的论坛,所以这是一个愚蠢的问题,但是在 VB.Net 中清除文本框的最佳方法是什么,这两种方法有什么区别?我也看到人们批评人们在他们的形式上使用清晰的物体,我明白为什么,
我想启用一个文本框并使其在单击按钮时可见(两者的默认设置均为 false)。我可以回发,但效率很低,所以我希望我的按钮激活 onClientClick 只是为了激活并使其可见。 我尝试过这个: JS:
这是我的代码,我认为到目前为止我做的是对的,但我真的不知道问题出在哪里。我正在用 txtbox 制作用户名和密码的注册表单我用 MD5 加密密码,我尝试删除 MD5 加密认为它可能是 prtoblem
我是一名优秀的程序员,十分优秀!