title: validation on postback if gridview is empty
body: <p>I am trying to provide an ok cancel popup 'if' the gridview has no rows and I thought this would work like a client script, but when I hit ok the control skips rest of the method. Is there anyway I could perform this validation or alert and move the control to the next statement?</p>
  
  <pre><code>protected void btnRunD_Click(object sender, EventArgs e)
   {
         try
          {
              int iESStatus = 0;
              int iRunStatus = 0;
              ApplicationUser au = (ApplicationUser)Session["ApplicationUser"];
              if (UploadFileGrid.Rows.Count &lt;= 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
             {.........}
  }
  </code></pre>
  
  <p>The part I'm having difficulty with is here:<br>
  I am trying to provide an ok cancel popup 'if' the gridview has no rows</p>
  
  <pre><code>if (UploadFileGrid.Rows.Count &lt;= 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?');",       
      }
  </code></pre>