我想提供一个好的取消弹出'如果'gridview没有行,我认为这会像客户端脚本,但是当我点击确定时,控制跳过方法的其余部分。无论如何,我可以执行此验证或警报并将控件移至下一个语句?验证回发如果gridview为空
protected void btnRunD_Click(object sender, EventArgs e)
{
try
{
int iESStatus = 0;
int iRunStatus = 0;
ApplicationUser au = (ApplicationUser)Session["ApplicationUser"];
if (UploadFileGrid.Rows.Count <= 0)
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "confirm('No new data files have been uploaded. Are you sure you want to run EYDS Processing Module?');",
//true);
}
if (au.RoleID != 2) //RoleID is not Admin!
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('You do not have enough privileges to use this functionality!');",
true);
}
else
{.........}
}
我有困难的部分是在这里:
我想提供一个确定取消弹出“如果” gridview的没有行
if (UploadFileGrid.Rows.Count <= 0)
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "confirm('No new data files have been uploaded. Are you sure you want to run?');",
}
你可以使用JavaScript函数做到这一点,而无需回发然后是否有任何特定的需要在回发函数上调用JavaScript函数? – Priya
显示更多代码。你确实需要在'确定'按钮点击执行? –
@Piya如何检查我的gridview在javascript中是否为空? – Aravindh