locked
mvc 3 jquery mobile: passing id to a form element through an action link inside a Listview RRS feed

  • Question

  • User-169393403 posted
    <ul data-role="listview" data-filter="true"> 
     @foreach (var favact in Model.ToList())
                  
              {
                  <li>
                  
                  <img src="@Url.Content("~/" + favact.act.Type.ImageURL)" alt="@Url.Content(favact.act.Type.Name)" id="LogActthumbnail" style="padding-left: 15px" />
                  @Html.ActionLink(favact.act.Description , "Createm", "Log",new { id = favact.ActID })
                  
                  <p style="padding-left: 15px">METS = @favact.act.METS
                  </p>
                  </li>
              }
    </ul>

    Do I have to add the ID to the Create Controller, and if so, my mobile nav logic is different from my web logic.  So do I make another action to represent the mobile method call, like: (but causes and error

    public ActionResult Createm(int id) 
            {
               FavAct createlog = db.FavActs.Find(id);
                ViewBag.DistanceID = new SelectList(db.Distances, "DistanceID", "DistanceName");
                ViewBag.IntensityID = new SelectList(db.Intensities, "IntensityID", "IntensityName");
                ViewBag.StudentID = new SelectList(db.Students, "StudentID", "FirstName");
                return View();


    This causes a script error on the controller.

    Saturday, January 7, 2012 12:36 PM