title: How to check for a Guid.Empty Id of a client side dropdown
body: <p>I have the following <code>ViewResult()</code> which populates a Model (holding two dropdowns) which in turn is sent to the strongly typed View().
  Notice how I add a new “<em>---VIEW ALL---</em>“ value in both dropdowns with the <strong>Id</strong> being a <code>Guid.Empty.</code></p>
  
  <pre><code>[HttpGet]
  public ViewResult ManageUsers()
  {
      var applicationList = _facade.Value.GetApplications().OrderBy(a =&gt; a.Name).ToList();
      applicationList.Add(new Application() { Id = Guid.Empty, Name = "---VIEW ALL---" });
  
      var roleList = _facade.Value.GetRoles(applicationList.First().Id).OrderBy(a =&gt; a.Name).ToList();
      roleList.Add(new Role() { Id = Guid.Empty, Name = "---VIEW ALL---" });
  
      var model = new ManageUsersModel();
      model.ApplicationList = new SelectList(applicationList, "Id", "Name", applicationList.First().Id);
      model.RoleList = new SelectList(roleList, "Id", "Name");
  
      return View(model);
  }
  </code></pre>
  
  <p>Once inside the View() I create a <code>jquery .change()</code> event for the first dropdown and I wish to detect the selected value.</p>
  
  <p>Based on the selected value, I need to take different actions. For example if the <code>Guid.Empty</code> value is selected then do this…if not, then to that…</p>
  
  <p>So far the code I have in the .change() event looks like this:</p>
  
  <pre><code>$('#ApplicationId').change(function () {
      if ($(this).val() === "00000000-0000-0000-0000-000000000000") {
          alert("aaa");
      }
      else {
          alert("xxx");
      }
  });
  </code></pre>
  
  <p>The code works but I find it <strong>ugly</strong> to check for the <code>Guid.Empty</code> the way I’m doing it.</p>
  
  <p>Does anyone have a different/better approach to achieve this?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Sincerely
  Vlince</p>
  
  <p>PS: Since this will be a Multilanguage application, I can’t use the <code>selected text</code> of the dropdown for the if(…) compare.</p>