Available in the Full Version

Editors - Load and Save Form Values

Error
Error
Error
Error
Error
Error

This sample is designed for a larger screen size.

On mobile, try rotating your screen, view full size, or email to another device.

Multiple igEditor controls are shown in this example of an edit form. The values of the editors are set on the server and the code example demonstrates how the changes are saved back to the server once the “Submit” button is pressed.

Code View

Copy to Clipboard
@using Infragistics.Web.Mvc
@using IgniteUI.SamplesBrowser.Models

@model IgniteUI.SamplesBrowser.Models.Northwind.Product

<!DOCTYPE html>

<html>
<head>
    <title></title>

    <!-- Ignite UI for jQuery Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />

    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

    <!-- Ignite UI for jQuery Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.lob.js"></script>

</head>
<body>
    <style type="text/css">
        td {
            vertical-align: top;
        }

        label {
            display: block;
            line-height: 20px;
        }

        .mainTable {
            position: relative;
            width: 350px;
            margin-left: -175px;
            left: 50%;
            border-collapse: collapse;
        }

        .fonts {
            font-family: Verdana;
            font-size: 0.8em;
        }

        #submitEvent {
            float: right;
            height: 30px;
            margin-top: 10px;
        }

        .success {
            color: #458B00;
            float: right;
        }

        @@media all and (max-width: 400px) {
            .mainTable {
                width: 180px;
                margin-left: -90px;
            }

            .mainTable td {
                float: left;
            }
        }
    </style>
    <div class="sampleContents">
        <div class="sample-container">
            @using (Html.BeginForm())
            {
            @Html.HiddenFor(m => m.ID)
            <table cellpadding="5" cellspacing="0" class="mainTable">
                <tr>
                    <td style="vertical-align:top;">           
                        <label class="fonts">
                            Product Name</label>
                        @(Html.Infragistics().TextEditorFor(m => m.ProductName)
                         .ID("textEditorProductName")
                         .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
                         .Width("160")
                         .Render())
                    </td>
                    <td>
                        <label class="fonts">
                            Quantity Per Unit</label>
                         
                        @(Html.Infragistics().NumericEditorFor(m => m.QuantityPerUnit)
                         .ID("numericEditorQuantityPerUnit")
                         .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
						.Width("160")
                         .Render())
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="fonts">
                            Unit Price</label>
                   
                        @(Html.Infragistics().CurrencyEditorFor(m => m.UnitPrice)
                         .ID("currencyEditorUnitPrice")
                         .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
						.Width("160")
                         .MinValue(0)
                         .Render())
                          
                    </td>
                    <td>
                        <label class="fonts">
                        Units in Stock</label>
                         
                        @(Html.Infragistics().NumericEditorFor(m => m.UnitsInStock)
                            .ID("numericEditorUnitsInStock")
                            .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
							.Width("160")
                            .MinValue(0)
                            .Render())
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="fonts">
                        Units on Order</label>
                         
                        @(Html.Infragistics().NumericEditorFor(m => m.UnitsOnOrder)
                            .ID("numericEditorUnitsOnOrder")
                            .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
							.Width("160")
                            .MinValue(0)
                            .Render())
                    </td>
                    <td>
                       <label class="fonts">
                         Reorder Level</label>
                         
                        @(Html.Infragistics().NumericEditorFor(m => m.ReorderLevel)
                            .ID("numericEditorReorderLevel")
                            .ValidatorOptions(m => m.Required(true).OnBlur(true).OnSubmit(true))
							.Width("160")
                            .MinValue(0)
                            .Render())
                       <input type="submit" id="submitEvent" value="Submit" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="border: none;">
                    @if (ViewData["message"] != String.Empty)
                    { 
                    <span class="success">@ViewData["message"]</span>
                    }
                    </td>
                </tr>
            </table>
            
            }
        </div>
    </div>
</body>
</html>