如何将DevEx文本框用作textboxfor?

时间:2012-07-31 09:57:48

标签: asp.net-mvc textbox devexpress

我无法找到关于此主题的任何示例。我尝试编写一些代码,但它发布了null模型。

@model DevExpressMvcApplication2.Models.Customers
@{
    ViewBag.Title = "MusteriEkle";
}
@using (Html.BeginForm((string)ViewBag.FormAction, "Home"))
{
<div class="editorContainer">
    @Html.DevExpress().TextBox(
            settings =>
            {
                settings.Name = "textBox1";
                settings.Width = 170;
                settings.Properties.NullText = "Enter your name...";
            }
        ).Bind(Model.customer_name).GetHtml()
</div>
<input type="submit" value="submit" />
}

是否有关于此主题的任何示例。我想将devEx元素用作html.helper和“for”

由于

2 个答案:

答案 0 :(得分:2)

必须在[HttpPost] Controller Action中使用DevExpressEditorsBinder并设置TextBox.Name属性=模型字段/属性。

答案 1 :(得分:0)

@Html.DevExpress().TextBoxFor(model => model.Code,
settings => {
settings.Name = "txtCode";
settings.Width = 170;
settings.Properties.NullText = "000"; }).GetHtml()