How to add the value that comes from the model to the textbox

0

Good I would like to know how to add the value that comes from the model to a textbox that is in the row of a table, in Devexpress this is the code that I have I need a line of code if I am not wrong it is something like content.Column but I do not remember the rest and I do not find it I appreciate any help thanks.

 settings.Columns.Add(c =>
        {
            c.FieldName = "Unidades";
            c.ColumnType = MVCxGridViewColumnType.ComboBox;
            c.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            c.SetDataItemTemplateContent(content =>
            {
                Html.DevExpress().TextBox(set =>
                {
                    set.Name = "TxtUnid" + content.VisibleIndex;
                    set.Text = content.Column;
                    set.Width = 40;
                }).Render();
            });
        });
    
asked by Juan David Gil 16.08.2016 в 18:45
source

1 answer

1

If we analyze the response of the official forum of Devexpress

GridView - How to set a TextBox value in the Column's DataItemTemplate based on the value of another TextBox

You'll see that there he mentions using the DataBinder.Eval()

col.SetDataItemTemplateContent(diTemplate => {
        GridViewDataItemTemplateContainer container = diTemplate as GridViewDataItemTemplateContainer;
        Html.DevExpress().TextBox(txtSettings => {
            txtSettings.Name = string.Format("txt_{0}", diTemplate.VisibleIndex);
            txtSettings.Text = DataBinder.Eval(diTemplate.DataItem, diTemplate.Column.FieldName).ToString();
            txtSettings.Properties.ClientSideEvents.GotFocus = string.Format("function(s, e) {{OnValueGotFocus(s, e, '{0}', '{1}'); }}", container.KeyValue.ToString(), container.Column.FieldName);
        }).Render();
    });
    
answered by 16.08.2016 в 19:54