DynDeveloper.com

DynDeveloper.com

Sign Up Now!Log In
Thruway2 11/19/2015 3:36:29 PM

.Net Econnect Integration Unexpected Behavior

We are working on a larger Econnect Integration using .NET MVC.  We have come across an issue whereas the eConnect model is not binding to our form POST when working with eConnect objects but instead are returning an empty object.  All other objects are binding as expected in our bigger integration.  I have torn it down to its simplest form following Microsoft MVC standard below to show our issue. Is this expected behavior for eConnect objects?

The odd part about this is it works in WebServices using their objects.  Unfortunaly there are some missing peices from WebServices, like UpdateItem.

 

Test:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.Dynamics.GP.eConnect.Serialization;
 
namespace Thruway_Intranet.Areas.Inventory.Controllers
{
    [OverrideAuthorization]
    [AllowAnonymous]
    public class TestController : Controller
    {
        // GET: Inventory/Test
        public ActionResult Index()
        {
            taUpdateCreateItemRcd item = new taUpdateCreateItemRcd();
            item.ITEMDESC = "dumby text";
 
            return View(item);
        }
 
        [HttpPost]
        public ActionResult Index(taUpdateCreateItemRcd newItem)
        {
             
            //returns ""
            var description1 = newItem.ITEMDESC;
 
            //returns value entered "dumby text"
            var description2 = Request.Form["ITEMDESC"];
 
            return View();
        }
    }
}
 
 
 
@model Microsoft.Dynamics.GP.eConnect.Serialization.taUpdateCreateItemRcd
 
@using (Html.BeginForm())
{
 
    <div class="form-horizontal">
 
        <div class="col-md-12">
 
            @* Displays "dumby text" *@
            <div class="form-group">
                @Html.LabelFor(model => model.ITEMDESC, "Item Description", htmlAttributes: new { @class = "control-label col-md-3" })
                <div class="col-md-9">
                    @Html.TextAreaFor(model => model.ITEMDESC, htmlAttributes: new { @class = "form-control", style = "height: inherit;", rows = "2", cols = "40" })
                    @Html.ValidationMessageFor(model => model.ITEMDESC, "", new { @class = "text-danger" })
                </div>
            </div>
 
            <div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-default" />
                </div>
            </div>
 
        </div>
    </div>
}
Version: GP 2010
Section: .NET Development, eConnect