| [aspx] <ej:Grid ID="Grid1" runat='server' MinWidth="400" Width="1380" Height="580" AllowSelection="true" AllowScrolling="true" AllowTextWrap="true" AllowResizing="true" IsResponsive="false" OnServerEditRow="Grid1_ServerEditRow"> <ScrollSettings Width="180" FrozenColumns="2" /> <Columns> <ej:Column Field="OrderID" Width="180" AllowEditing="false" CssClass="solution" HeaderText="ColumnName" /> <ej:Column Field="CustomerID" Width="350" HeaderText="CustomerID" CssClass="Philips" HeaderTextAlign="center" DisableHtmlEncode="false" HeaderTemplateID="#PhilipsHeader" > <EditTemplate Create="create" Read="Philipsread" Write="Philipswrite" /> </ej:Column> ... </Columns> </ej:Grid> <script type="text/javascript"> function create() { return $("<textarea class='e-field' rows=5 style='width: 100%;'></textarea>"); } function Philipswrite(args) { args.element.val(args.rowdata["Freight"]); $(args.element.parents('td')[0]).append("<textarea id='PhilipsComments' type='text' rows=3 style='width: 100%;' name='PhilipsComments'></textarea>"); $(args.element.parents('td')[0]).append('<input type="checkbox" name="Philipscheckbox" id="Philipscheckbox"><label for="Philipscheckbox">Win or Lose</label>'); args.rowdata["Comment"] != null ? $("#PhilipsComments").val(args.rowdata['Comment']) : $("#PhilipsComments").attr('placeholder', 'Additional Comments'); } [aspx.cs] protected void Grid1_ServerEditRow(object sender, GridEventArgs e) { //code corresponding to any custom operation. In the variable you can get the values of the edited record. } |
| function create() { return $("<textarea class='e-field' rows=5 style='width: 100%;'></textarea>"); } function Philipswrite(args) { args.element.val(args.rowdata["Freight"]); $(args.element.parents('td')[0]).append("<textarea id='PhilipsComments' type='text' rows=3 style='width: 100%;' name='PhilipsComments'></textarea>"); $(args.element.parents('td')[0]).append('<input type="radio" name="Phcheck" id="PhcheckboxBetter" value="PhcheckboxBetter"><label for="PhcheckboxBetter">Better than Ph</label><br/>'); $(args.element.parents('td')[0]).append('<input type="radio" name="Phcheck1" id="PhcheckboxWorse" value="PhcheckboxWorse"><label for="PhcheckboxWorse">Worse than Ph</label><br/>'); $(args.element.parents('td')[0]).append('<input type="radio" name="Phcheck2" id="Phcheckbox50" value="Phcheckbox50"><label for="Phcheckbox50">50/50 with Ph</label><br/>'); args.rowdata["Comment"] != null ? $("#PhilipsComments").val(args.rowdata['Comment']) : $("#PhilipsComments").attr('placeholder', 'Additional Comments'); } |
| <ej:Grid ID="Grid1" runat='server' MinWidth="400" Width="1380" Height="580" AllowSelection="true" AllowScrolling="true" AllowTextWrap="true" AllowResizing="true" IsResponsive="false" OnServerEditRow="Grid1_ServerEditRow"> <ScrollSettings Width="180" FrozenColumns="2" /> <Columns> <ej:Column Field="OrderID" Width="180" AllowEditing="false" CssClass="solution" HeaderText="ColumnName" /> <ej:Column Field="CustomerID" Width="350" HeaderText="CustomerID" CssClass="Philips" HeaderTextAlign="center" DisableHtmlEncode="false" HeaderTemplateID="#PhilipsHeader" > <EditTemplate Create="create" Read="Philipsread" Write="Philipswrite" /> </ej:Column> <ej:Column Field="EmployeeID" Width="350" HeaderText="EmployeeID" CssClass="Tera" HeaderTextAlign="center" DisableHtmlEncode="false" HeaderTemplateID="#TeraHeader" > <EditTemplate Create="create" Read="Teraread" Write="Terawrite" /> </ej:Column> <ej:Column Field="Freight" Width="350" HeaderText="Freight" CssClass="Siemens" HeaderTextAlign="center" DisableHtmlEncode="false" HeaderTemplateID="#SiemensHeader" > <EditTemplate Create="create" Read="Siemensread" Write="Siemenswrite" /> </ej:Column> <ej:Column Field="OrderID" IsPrimaryKey="true" Width="0" HeaderText="OrderID" /> </Columns> <ClientSideEvents DataBound="createEvent" ActionComplete="complete" /> </ej:Grid> <script type="text/javascript"> var val, radioval; function create() { return $("<textarea class='e-field' rows=5 style='width: 100%;'></textarea>"); } function Philipswrite(args) { args.element.val(args.rowdata["Freight"]); $(args.element.parents('td')[0]).append("<textarea id='PhilipsComments' type='text' rows=3 style='width: 100%;' name='CustomerID'></textarea>"); $(args.element.parents('td')[0]).append('<input type="radio" name="PhCheck" id="PhcheckboxBetter" value="PhcheckboxBetter"><label for="PhcheckboxBetter">Better than Ph</label><br/>'); $(args.element.parents('td')[0]).append('<input type="radio" name="PhCheck" id="PhcheckboxWorse" value="PhcheckboxWorse"><label for="PhcheckboxWorse">Worse than Ph</label><br/>'); $(args.element.parents('td')[0]).append('<input type="radio" name="PhCheck" id="Phcheckbox50" value="Phcheckbox50"><label for="Phcheckbox50">50/50 with Ph</label><br/>'); args.rowdata["Comment"] != null ? $("#PhilipsComments").val(args.rowdata['Comment']) : $("#PhilipsComments").attr('placeholder', 'Additional Comments'); } function Philipsread(args) { val = $("#PhilipsComments").val(); radioval = $("input[type='radio'][name='PhCheck']:checked").val(); return args.val() } function complete(args) { if (args.requestType == "save") { args.data.PhCheck = radioval; args.rowData.PhCheck = radioval; } } </script> |