Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This my html code :
HTML
using (Html.BeginForm("SuccessFacebookPost", "JobOffer"))
{
   <div class="hiddenF">
   <ul id="childCheckBox">
        <a id ="page" href="#"><input id="OnPage" type="checkbox" class="childCheckBox" name="BoxChecked" value="OnPage" />@ApplicationResources.PostOnPage</a>
        <a id ="mur" href="#"><input id="OnWall" type="checkbox" class="childCheckBox" name="BoxChecked" value="OnWall" />@ApplicationResources.PostOnWall</a>
   </ul>
   </div>
}

This is my controller code :
C#
public ActionResult SuccessFacebookPost(string[] BoxChecked)
{

   var ids = (IEnumerable<int>)Session["ids"];
   foreach (var id in ids)
   {
      var fbConfig = manager.SocialNetworkConfigManager.GetSocialNetworkConfigByName("Facebook");
      var credentials = new FacebookCredentials
         {
            ApiKey = fbConfig.ApiKey,
            ApiSecret = fbConfig.ApiSecret,
            CallbackUrl = fbConfig.CallbackUrl,
            AccountId = fbConfig.AccountId
         };
      FacebookEngine FBEngine = new FacebookEngine(credentials);
      var joboffer = manager.JobOffer.GetJobOfferById(id);
      if (BoxChecked[0] == "OnPage")
      {
         FBEngine.PostJob(joboffer);
      }
      if (BoxChecked[1] == "OnWall")
      {
         FBEngine.PostJobOnWall(joboffer);
      }
   }
}

BoxChecked is always null , I don't understand where is exactely the error .
All what I want is just to test the value of the checked box and execute the corresponding function .
Any help please
Posted
Updated 20-May-14 12:21pm
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900