//驗証新增數據
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
string mtno = "";
if (e.Values[0] != null)
{
mtno = e.Values[0].ToString();
}
if (string.IsNullOrEmpty(mtno))
{
AjaxHelper.showAlert(UpdatePanel1, "請填寫材料編號!");
e.Cancel = true;
}
}
本文介绍了一个ASP.NET应用程序中验证新增数据的方法。通过在ItemInserting事件中检查输入的材料编号是否为空来确保数据的完整性。如果材料编号未填写,则会弹出提示并取消插入操作。
13

被折叠的 条评论
为什么被折叠?



