Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2745
Always show inputs in the grid
posted

My grid is able to be edited.  When a user clicks and selects a row, the label disappears and an input shows up.  My client would like the input to show up all the time to give their staff instant visual indication that certain columns are editable rather than having them click on them first.

How would I achieve this?

Parents
No Data
Reply
  • 19693
    posted

    Hello Daniel,

    I can suggest you using RowTemplate for the purpose.

    You can use input field for the editable columns (ModifiedDate and List Price)

    <td data-key='${ModifiedDate}'><input value ='${ModifiedDate}'/></td>

    <td data-key='${ListPrice}'><input value ='${ListPrice}'/></td>

    Please take a look at the code snippet below.

    <%= Html.Infragistics().Grid(Model).ID("grid2").Height("500px").PrimaryKey("ProductID")

            .AutoCommit(false)   

            .Columns(column =>

            {

                column.For(x => x.ProductID).Width("150px");

                column.For(x => x.Name).Width("200px");

                column.For(x => x.ModifiedDate).Width("200px");

                column.For(x => x.ListPrice).Width("150px");

                }).Features(features => {

                    features.Sorting();

                    features.Updating();

                })

               .GenerateCompactJSONResponse(false)

    .RowTemplate("<tr><td> ${ProductID} </td><td class='editableField'>${Name}</td><td data-key='${ModifiedDate}'><input value ='${ModifiedDate}'/></td><td data-key='${ListPrice}'><input value ='${ListPrice}'/></td> </tr>")

                .DataSourceUrl(Url.Action("EditingGetData"))

                .UpdateUrl("EditingSaveChanges")

                .DataBind()

                .Render() %>

    Let us know if you need further assistance.

Children