asp.net 点击按钮后 弹出确认提示
代码如下
protected void BtnBookTypeAdd_Click(object sender, EventArgs e)
{
//遍历所有控件
decimal max_score =0;
decimal pf_score = 0;
decimal ckbox_score = 0;
decimal txtbox_score = 0;
decimal zf = 0;
foreach (RepeaterItem c in RpBookType.Items)
{
CheckBox check = (CheckBox)c.FindControl("chk_active");
TextBox txtbox = (TextBox)c.FindControl("txt_active");
Label lbl_PFXL_SCORE = (Label)c.FindControl("lbl_PFXL_SCORE");
Label lbl_PFDL_NAME = (Label)c.FindControl("lbl_PFDL_NAME");
Label lbl_PFXL_NAME = (Label)c.FindControl("lbl_PFXL_NAME");
Label lbl_PFDL_ID = (Label)c.FindControl("lbl_PFDL_ID");
Label lbl_PFXL_ID = (Label)c.FindControl("lbl_PFXL_ID");
max_score = Convert.ToDecimal(lbl_PFXL_SCORE.Text.ToString());
//先做一些输入合法性的判断
if (DAL.DataOperWj.IsNumric_wj(txtbox.Text.ToString()) == false) //是否是合法的格式
{
Common.ShowMessage.Show(Page, "error", "二级分类 " + lbl_PFXL_NAME.Text.ToString() + " 输入的格式错误,请检查! ");
return;
}
if (txtbox.Text.ToString().Trim().IndexOf('-') > -1)
{
Common.ShowMessage.Show(Page, "error", "二级分类 " + lbl_PFXL_NAME.Text.ToString() + " 有非法字符,请检查! ");
return;
}
pf_score = Convert.ToDecimal(txtbox.Text.ToString()); //合法的格式再转换
if (pf_score > max_score && txtbox.Visible==true ) //是否大于最高分
{
Common.ShowMessage.Show(Page, "error", "二级分类 " + lbl_PFXL_NAME.Text.ToString() + " 列,大于最高分,请检查! " );
return;
}
//合法检查结束,算个总分
txtbox_score = txtbox_score + Convert.ToDecimal(txtbox.Text.ToString().Trim());
if (check.Checked == true)
{
ckbox_score = ckbox_score + Convert.ToDecimal(lbl_PFXL_SCORE.Text.ToString().Trim());
}
}
//总分
zf = txtbox_score + ckbox_score;
//前面是一系列的判断,遍历repeater 取数
//取完后,算出个总分,确认是否提交
this.BtnBookTypeAdd.Attributes.Add("onclick", "return confirm('总分为: "+zf+" 确定提交吗? ');");
//选择是就提交,否就什么都不做,上面那句好像不行
//todo 写库。
}
...全文
相关推荐
asp.net中如何用c#实现弹出式的交互对话窗口
asp.net中如何用c#实现弹出式的交互对话窗口
asp.net中弹出消息框后跳转页面
asp.net中实现弹出消息框后跳转至另一带参数页面 集合的一个TXT
【ASP.NET编程知识】总结ASP.NET C#中经常用到的13个JS脚本代码.docx
【ASP.NET编程知识】总结ASP.NET C#中经常用到的13个JS脚本代码.docx
asp.net 弹出框组件
asp.net 右下角弹出新提醒信息提示框,具体使用参考博客: http://blog.csdn.net/zdw_wym/article/details/42500069
ASP.NET中为GridView添加删除提示框的方法
本文实例讲述了ASP.NET中为GridView添加删除提示框的方法。分享给大家供大家参考。具体分析如下: 在GridView中我们可以直接添加一个CommandField删除列来删除某行信息。但为了避免误操作引起的误删除,在删除操作者让操作者再确认下,完后再进行删除。 首先我们给我们的GridView 添加一个模板列,如下: 以下是引用片段: <ASP HeaderText=Delete ShowHeader=False> <ItemStyle ForeColor=Red> <ItemTemplate> <asp:LinkButton ID=


