title: How i can have two effects for my data-dismiss="modal" ;one to reload the parent page , while the other without loading
body: <p>I am working on an asp.net mvc web application. and i define the following javascript to always reload the parent page when the user close the modal dialog:-</p>
  
  <pre><code>  $(function () {
  
          $(document).on('click', 'button[data-dismiss]', function (e) {
              location.reload();
          }); });
  </code></pre>
  
  <p>but i need to make this more dynamic, basically by having the option to specify if i want to reload the parent page or not. so i moved the modal header to be inside a partial view as follow, and pass a bool value to reload or not:-</p>
  
  <pre><code>@model Boolean
  
  &lt;div class="modal-header"&gt;
  
  
       @{if(Model){ //Reload
          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;}
      else if(!Model){ //Do not reload
          &lt;button type="button" class="close" data-dismiss="modal2" aria-hidden="true"&gt;×&lt;/button&gt;}
          }
  
      &lt;/div&gt;
  </code></pre>
  
  <p>so i will be calling the modal header as follow:-</p>
  
  <pre><code> Html.RenderPartial("_modalHeader",true); 
  </code></pre>
  
  <p>The problem i am facing is as follow:-</p>
  
  <p>how to specify if i want to reload the parent record or not, inside the :-</p>
  
  <pre><code>  &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
  </code></pre>
  
  <p>Second problem how to let javascript know weather to reload or not?</p>