我正在尝试构建一个多语言MVC应用程序.我的应用程序中有一个表单,我有字段输入成本.我能够使用西班牙文化创建一个记录.
但是在尝试更新记录时,我得到了jquery验证错误.我收到一条默认错误消息:
该字段必须为数字.
在我的视图模型中,我设置了以下属性.
[LocalizedDisplayName("Label_Cost")]
[RegularExpression("^[^<>,<|>]+$", ErrorMessage = null, ErrorMessageResourceName = "Error_Message_Html_Tags_Prevented", ErrorMessageResourceType = typeof(Resources))]
[Range(0, 9999.99, ErrorMessage = null, ErrorMessageResourceName = "Error_Message_Cost_Not_Valid", ErrorMessageResourceType = typeof(Resources))]
public decimal? Cost { get; set; }
我已经在我的Gobal.asax文件中设置了以下内容
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
    try
    {
        HttpCookie cookie = HttpContext.Current.Request.Cookies.Get("CurrentCulture");
        string culutureCode = cookie != null && !string.IsNullOrEmpty(cookie.Value) ? cookie.Value : "en";
        CultureInfo ci = new CultureInfo(culutureCode);
        System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
        System.Threading.Thread.CurrentThread.CurrentCulture =
        CultureInfo.CreateSpecificCulture(ci.Name);
    }
    catch(Exception ex)
    {
        // Code
    }
}
并且上述方法在服务器端按预期工作以改变文化.但是客户端验证打破了非英语文化,因为javascript只识别十进制文字.我想知道使用特定于文化的验证来扩展mvc客户端验证的最佳方法.
编辑 …
我们计划将Magento与Microsoft AX 2009(产品和客户)集成.由于我是C#开发人员,我很困惑如何开始.在探索时我发现了最好的集成方式是通过WCF.但我想知道
我无法在网上找到一个好的资源.所以任何人都可以建议一个好的资源,或者哪个是最好的方法.
如何从 umbraco mvc 中的表面控制器添加查询字符串。这是我目前的代码。
最初我写了一个代码
public ActionResult Registration(RegisterModel model)
{ 
  //Code to insert register details
  ViewBag.Success="Registered Successfully"
  return CurrentUmbracoPage();
}
有了这个,我可以成功地保留我的 ViewBag 和模型属性值,但我无法用它添加查询字符串。
对于某些要求,我必须更改返回带有查询字符串的 url 的代码。我做了如下
public ActionResult Registration(RegisterModel model)
{ 
    //Code to insert register details
    ViewBag.Success="Registered Successfully"
    pageToRedirect = AppendQueryString("success");
    return new RedirectResult(pageToRedirect);
}
public string AppendQueryString(string queryparam)
{
    var pageToRedirect = new DynamicNode(Node.getCurrentNodeId()).Url;
    pageToRedirect += "?reg=" + queryparam;
    return pageToRedirect;
}
有了这个,我的模型中的属性值无法持久化,并且 ViewBag 返回空值。
任何人都可以建议我如何通过将值保留在模型和 ViewBag 中来添加查询字符串。
asp.net-mvc ×2
ax ×1
c# ×1
magento ×1
umbraco ×1
umbraco6 ×1
validation ×1
web-services ×1
x++ ×1