protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e) { TextBox HolidayTB = (TextBox)e.Item.FindControl("HolidayTextBox"); if (HolidayTB.Text.ToString()=="") { e.Cancel = true; Response.Write("<script type='text/javascript'>"); Response.Write("alert('Please input the date.');"); Response.Write("</script>"); //Response.Redirect("Holiday.aspx"); } }
Listview 插入記錄前判斷textbox 值是否為空,如是取消保存
最新推荐文章于 2021-05-27 04:06:20 发布