title: how to check if an Input values is empty
body: <p>I have the following Ajax Begin form :-</p>
  
  <pre><code>@using (Ajax.BeginForm("AssignUsers", "SecurityGroup", 
  
  
      new AjaxOptions
  {
      HttpMethod = "POST",
      InsertionMode = InsertionMode.Replace,
      UpdateTargetId = "UsersAssignment"//,
     // LoadingElementId = "progress",
     // OnSuccess = "reenable"
  }))
  {
      @Html.HiddenFor(Model =&gt; Model.GroupID)
      @Html.AntiForgeryToken()
  &lt;p&gt;Search  &lt;input  placeholder="Search by name.." name="selectedUserNames" type="text" data-autocomplete-source= "@Url.Action("AutoComplete", "SecurityGroup")" /&gt; &lt;/p&gt;
  
  &lt;input type="submit" value="Search" /&gt;
  }
  </code></pre>
  
  <p>But the problem is that is the user did not enter any value in the Test Input field, then an empty sting will be passed ato the database. so how i can check if the array contains empty string or not.</p>
  
  <p>The action method which will handle the view is :-</p>
  
  <pre><code>[HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult AssignUsers(int GroupID, string[] selectedUserNames, string[] currentUserNames)
          { try
              {if (ModelState.IsValid)
                 {repository.AssignUserGroup(GroupID, selectedUserNames, currentUserNames);
                      repository.Save();
                      if (!Request.IsAjaxRequest())
                      {
                          return RedirectToAction("Details", new { id = GroupID });
                      }
                      else if (Request.IsAjaxRequest())
                      {var ADUsers = repository.GetADUsers(null);
                          var group = repository.FindAllGroup(GroupID);
                          PopulateAssignedUsersData(group, ADUsers);
                          return PartialView("_Group", group);
  </code></pre>
  
  <p>and the repository method is :-</p>
  
  <pre><code>public void AssignUserGroup(int id, string[] selectedUsers, string[] currentusernames)
          {
              var usergroups = tms.UserGroups.Where(a=&gt;a.GroupID == id);
              foreach (var ug in usergroups)
              {
                  if (currentusernames != null)
                  {for (int c = 0; c &lt; currentusernames.Count(); c++)
                      {if (ug.UserName == currentusernames[c])
                          {tms.UserGroups.Remove(ug);
                          }}}}
                  if( selectedUsers !=null){
                 for (int i = 0; i &lt; selectedUsers.Count(); i++)
                 {UserGroup usergroup = new UserGroup();
                     usergroup.GroupID = id;
                     usergroup.UserName = selectedUsers[i];
                     tms.UserGroups.Add(usergroup);} } }
  </code></pre>