IF anyone can help me with this it would be greatly appreciated.
My situation is as follows;
My grid, has some custom formattting applied to it. The inital select works fine, but when a do an Ajax Update(), the formatting gets completely messed up(The colours are all red, this this example). The only way to reshow the grid with the correct formatted colours is to Reload the entire page.
@(Html.Telerik().Grid(Model)
.Name(
"PageMasters")
.DataKeys(keys =>
{
keys.Add(p => p.PAGENO);
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select(
"_SelectAjaxEditing", "PageMaster")
.Insert(
"_InsertAjaxEditing", "PageMaster")
.Update(
"_UpdateAjaxEditing", "PageMaster")
.Delete(
"_DeleteAjaxEditing", "PageMaster");
})
.Columns(columns =>
{
columns.Bound(p => p.PAGENO).Width(210);
columns.Bound(p => p.DESCRIPTION).Width(130);
columns.Bound(p => p.MAXVARIABLES);
columns.Bound(p => p.CAPTUREFLG)
.ClientTemplate(
"<input type='checkbox' disabled='disabled' name='CAPTUREFLG' <#= CAPTUREFLG? checked='checked' : '' #> />");
columns.Command(commands =>
{
commands.Edit().ButtonType(type);
commands.Delete().ButtonType(type);
}).Width(180).Title(
"Commands");
})
.CellAction(cell =>
{
if (cell.Column.Member == "MAXVARIABLES")
{
if (cell.DataItem.MAXVARIABLES < 10)
{
cell.HtmlAttributes[
"style"] = "background: Green;";
}
else if (cell.DataItem.MAXVARIABLES > 10 && cell.DataItem.MAXVARIABLES < 20)
{
cell.HtmlAttributes[
"style"] = "background: Yellow;";
}
else if (cell.DataItem.MAXVARIABLES > 20 && cell.DataItem.MAXVARIABLES < 30)
{
cell.HtmlAttributes[
"style"] = "background: Orange;";
}
else if (cell.DataItem.MAXVARIABLES > 30)
{
cell.HtmlAttributes[
"style"] = "background: Red;";
}
}
})
.Pageable(page => page.PageSize(10))
.Scrollable()
.Sortable()
)