我想提供一個好的取消彈出'如果'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