title: Open modal Popup on pageload event from server side using c#
body: <p>I want to show modal popup on certain certain condition on page load event but it is now working.</p>
  
  <p>this is my modalPopup:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function openModal(message, header, url) {
          $('#myModal').modal('show');
          $('#lblMasterMessage').html(header);
          $('#lblMasterbodyMessage').html(message);
          $('#myModal').on('hidden.bs.modal', function(e) {
              if (url != '') {
                  window.location = url;
              }
          });
      }
  &lt;/script&gt;
  
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="BodyContentPlaceHolder" runat="Server"&gt;
      &lt;div class="modal fade" id="myModal" runat="server"&gt;
          &lt;div class="modal-dialog"&gt;
              &lt;div class="modal-content" style="width: 400px; margin: 0 auto;"&gt;
                  &lt;div class="modal-header" runat="server"&gt;
                      &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                                  &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
                      &lt;h4 class="modal-title"&gt;
                          &lt;label id="lblMasterMessage"&gt;&lt;/label&gt;
                      &lt;/h4&gt;
                  &lt;/div&gt;
                  &lt;div class="modal-body"&gt;
                      &lt;label id="lblMasterbodyMessage"&gt;&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class="modal-footer"&gt;
                      &lt;button type="button" class="btn btn-primary" data-dismiss="modal" runat="server"&gt;Close&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Calling modal popup from Backend:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
       if (dt.Rows.Count &gt; 0)
       {
           BindGrid();
       }
       else
       {
            string message = "Files are not Generated!";
            string header = "Info";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "popup","openModal('" + message + "','" + header + "','MemberHomePage.aspx');", true);
           //ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Business Operation Files are not Generated!'); window.location ='MemberHomePage.aspx';", true);
       }
  }
  </code></pre>
  
  <p>i am not able to show popup when condition is satisfied. Any help will be appreciated.</p>