我在editform中的文本框
Html.DevExpress().TextBox(
edtSettings =>
{
edtSettings.Name = "ID";
edtSettings.ShowModelErrors = true;
edtSettings.Width = Unit.Percentage(100);
edtSettings.Height = Unit.Pixel(30);
}).Bind(DataBinder.Eval(c.DataItem, "ID")).Render();
editform创建活动
settings.HtmlEditFormCreated = (sender, e) =>
{
var s = sender as MVCxGridView;
if (!s.IsNewRowEditing)
{
ASPxTextBox txtID = ((ASPxTextBox)s.FindEditFormTemplateControl("ID"));
if (txtID != null)
{
txtID.ReadOnly = true;
}
}
};
我调试时,txtID为null。如何找到它?
答案 0 :(得分:2)
为什么呢?只需在其“设置”对象中直接自定义“ID”TextBox:
Html.DevExpress().TextBox(edtSettings => {
edtSettings.Name = "ID";
//ALL SETTINGS ARE RIGHT HERE...
}).Bind(DataBinder.Eval(c.DataItem, "ID")).Render();