如何将两个字符串值(数量和价格)相乘,然后在字符串netValue的输入中获取,其中AJAX cs代码如下:
protected void Page_Load(object sender, EventArgs e)
{
string brandName = "";
string itemName = "";
string itemId = "";
string quantity = "";
string price = "";
string netValue = "";
然后
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
HTML动态表正文:
string html = "";
html += "<tr>";
html += "<td class='style39'>";
html += "<input type='textbox' value='" + brandName + "' Width='98px'></input>";
html += "</td>";
html += "<td class='style39'>";
html += "<input type='textbox' value='" + itemId + "' Width='98px'></input>";
html += "</td>";
html += "<td class='style41'>";
html += "<input type='textbox' value='" + itemName + "' Width='169px'></input>";
html += "</td>";
html += "<td class='style43'>";
html += "<input type='textbox' value='" + quantity + "' Width='84px'></input>";
html += "</td>";
html += "<td class='style49'>";
html += "<input type='textbox' value='" + price + "' Width='95px'></input>";
html += "</td>";
html += "<td class='style51'>";
html += "<input type='textbox' value='" + netValue + "' Width='98px'> </input>";
html += "</td>";
html += "</tr>";
Response.Write(html);
Response.End();
Response.Flush();
}
答案 0 :(得分:0)
我解决了它:
decimal Result;
Result = Convert.ToDecimal(string.IsNullOrEmpty(quantity) ? "0" : quantity) * Convert.ToDecimal(string.IsNullOrEmpty(price) ? "0" : price);
netValue = Result.ToString();
但是在创建行并输入数量值之后,没有定义任何操作来检测数量输入中输入的值,那么有什么解决方案吗?