Question

my textbox in 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 create event

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 is null when i debug. How to find it?

Was it helpful?

Solution

Why? Simply customize the "ID" TextBox directly within its "setting" object:

Html.DevExpress().TextBox(edtSettings => {
    edtSettings.Name = "ID";
    //ALL SETTINGS ARE RIGHT HERE...

}).Bind(DataBinder.Eval(c.DataItem, "ID")).Render();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top