In my project we upgraded infragistics NetAdvantage 2012.1 to IgniteUI 2013.1 and also mvc4 (Infragistics.Web.Mvc.dll),
We used template for check box in ig-grid to display status and it is working fine in NetAdvantage 2012.1 version but when we upgraded to new version that check box in ig-grid is not displaying properly as showing status as unchecked every time when we checked and saved also.
please find below code written in cshtml
for loading script and css
<script src="@Url.Content("~/Scripts/InfragisticsjQueryMVC/common/js/infragistics.loader.js")" type="text/javascript"></script>
@(Html.Infragistics().Loader().ScriptPath(Url.Content("~/Scripts/InfragisticsjQueryMVC/common/js/")).CssPath(Url.Content("~/Scripts/InfragisticsjQueryMVC/common/css/")).Theme("metro").Render())
@(Html.Infragistics().Loader().ScriptPath(Url.Content("~/Scripts/InfragisticsjQueryMVC/common/js/")).CssPath(Url.Content("~/Scripts/InfragisticsjQueryMVC/common/css/")).Theme("metro").Resources("igCombo").Render())
for Grid
@( Html.Infragistics().Grid<LoneOakOrigination.Domain.Template>() .ID("igGridAdminTemplates") .AutoGenerateColumns(false) .PrimaryKey("PKTemplateID") .RenderCheckboxes(true) .Columns(column => { column.For(x => x.PKTemplateID).HeaderText("PKTemplateID").Width("0px").Hidden(true); column.For(x => x.Category).HeaderText("Category").Width("170px"); column.For(x => x.Description).HeaderText("Description").Width("200px"); column.For(x => x.FileName).HeaderText("Filename").Width("240px"); column.For(x => x.UpdatedDate).HeaderText("Updated Date").Width("100px").Format("MM/dd/yyyy"); column.For(x => x.Active).HeaderText("Active?").Width("80px").Template("<input type=\"checkbox\" {{if ${Active} === \"true\"}} checked=\"checked\" {{/if}} data-rowid=\"${PKTemplateID}\" disabled=\"disable\">"); column.For(x => x.Path).HeaderText("Downloads").Width("110px").Template("<img src='../Images/Download.png' Title='Download Template' onclick='DownloadTemplate(${PKTemplateID})'/> <img src='../Images/Gear.png' title='Test Template' onclick='PreviewTemplate(${PKTemplateID})' />"); }) .Features(features => { features.Filtering(); features.Paging().PageSize(50).ShowPageSizeDropDown(false); features.Sorting().Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("PKTemplateID").AllowSorting(true).CurrentSortDirection("desc"); }); features.Updating().EditMode(Infragistics.Web.Mvc.GridEditMode.Row).Validation(true).StartEditTriggers(GridStartEditTriggers.DblClick).EnableAddRow(false); features.Selection().MouseDragSelect(true).MultipleSelection(true).Mode(SelectionMode.Row); features.Updating().ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("PKTemplateID").ReadOnly(true); settings.ColumnSetting().ColumnKey("Category").ReadOnly(true); settings.ColumnSetting().ColumnKey("FileName").ReadOnly(true); settings.ColumnSetting().ColumnKey("UpdatedDate").ReadOnly(true); settings.ColumnSetting().ColumnKey("Path").ReadOnly(true); }); }) .Virtualization(false) .GenerateCompactJSONResponse(false) .ClientDataSourceType(ClientDataSourceType.JSON) .DataSourceUrl(Url.Action("GetAdminTemplates", "AdminTemplates")) .UpdateUrl(Url.Action("UpdateAdminTemplates", "AdminTemplates")) .AutoCommit(true) .Width("900px") .Height("500") .LocalSchemaTransform(true).JQueryTemplating(false) .DataBind() .Render() )
in above code "Active" column check box is creating issue. Please provide a solution as soon as possible
Hello,
please provide help on above issue . it is very urgent for me
Thanks
Gopi.T
Hello Gopi.T,
From the code you provided it's not clear what is the data type of the Active column.
Try to set the data type of the Active column explicitly using the .DataType() method. I suspect that the Active column data type is bool. If it is, then along with explicitly setting the data type you need to change your template string so that you compare Active value with bool true/false.
Here is the template string for a boolean column:
"<input type=\"checkbox\" {{if ${Active} === true}} checked=\"checked\" {{/if}} data-rowid=\"${PKTemplateID}\" disabled=\"disable\">"
Hope this helps,Martin PavlovInfragistics, Inc.
Hi martin
Thanks for your reply. its working fine now.