这是后台代码
protected void txtMan_Count_TextChanged(object sender, EventArgs e)
{
receive_line receiveline = receive_lineService.FindReceiveLineById(Int32.Parse(this.ObjectId));
int ManCount = 0;
int ChildCount = 0;
try
{
ManCount = Int32.Parse(txtMan_Count.Text);
ChildCount = Int32.Parse(txtChild_Count.Text);
}
catch
{
warnDiv.InnerText = "人数只能为数字,请检查您输入的信息是否有误!";
warnDiv.Attributes.Add("style", "display:block");
}
total_price.InnerText = (ManCount * receiveline.man_sale_price + ChildCount * receiveline.child_sale_price).ToString();
前台文本框代码
成人
<asp:TextBox ID="txtMan_Count" Width="20px" Height="18px" runat="server"
Text="1" ontextchanged="txtMan_Count_TextChanged"></asp:TextBox>人
儿童
<asp:TextBox ID="txtChild_Count" Width="20px" Height="18px" runat="server"
Text="0" ontextchanged="txtMan_Count_TextChanged"></asp:TextBox>人
(金额总计:<b id="total_price" runat="server"></b>起)<div id="warnDiv" runat="server" style="display:none; color:Red;"></div>
}
protected void txtMan_Count_TextChanged(object sender, EventArgs e)
{
receive_line receiveline = receive_lineService.FindReceiveLineById(Int32.Parse(this.ObjectId));
int ManCount = 0;
int ChildCount = 0;
try
{
ManCount = Int32.Parse(txtMan_Count.Text);
ChildCount = Int32.Parse(txtChild_Count.Text);
}
catch
{
warnDiv.InnerText = "人数只能为数字,请检查您输入的信息是否有误!";
warnDiv.Attributes.Add("style", "display:block");
}
total_price.InnerText = (ManCount * receiveline.man_sale_price + ChildCount * receiveline.child_sale_price).ToString();
前台文本框代码
成人
<asp:TextBox ID="txtMan_Count" Width="20px" Height="18px" runat="server"
Text="1" ontextchanged="txtMan_Count_TextChanged"></asp:TextBox>人
儿童
<asp:TextBox ID="txtChild_Count" Width="20px" Height="18px" runat="server"
Text="0" ontextchanged="txtMan_Count_TextChanged"></asp:TextBox>人
(金额总计:<b id="total_price" runat="server"></b>起)<div id="warnDiv" runat="server" style="display:none; color:Red;"></div>
}
解决方案 »
- 在aspx.cs中,将函数或变量定义在Page_Load之外,该函数的生命周期是什么?
- 使用Visual Studio 2005,可以没有项目文件吗?
- 使用RDLC的疑问(DataTable中有多条数据为什么只显示一页)
- 微软ajax组件和微软(url)重写组件在(VS2005)Web.Config中的正确配置
- asp.net的问题 DetailsView中如何取控件的值
- FCKeditorAPI 未定义
- 请问重装系统后要怎样恢复以前的项目?谢谢~~~
- 请问LINKBUTTON按下后关闭浏览器的代码怎么写(C#)?
- 请问如何在vs.net中实现CrystalReport打印
- 新手求教.net中treeview Tapstrip multipage toolbar的用法
- asp.net mvc保存提交弹出对话框并刷新页面(清空)
- 求一个精致的层阴影效果。(阴影是渐变且透明的那种)
Text="1" ontextchanged="txtMan_Count_TextChanged" AutoPostBack="true"></asp:TextBox>