This question is locked. New answers and comments are not allowed.
Hi Team,
We are experiencing the following issue while using the Delete button column in the Grid
We need to have a Delete column in the grid to delete the row. But Unfortunately, when I add the delete command, my grid getting splitted. Kindly provide us the right direction as soon as possible. Here is the code on creating/binding grid:
<table style="height:100%;">
<tr>
<td colspan="5">
@Html.Telerik().Grid(CommentsLog).Name("gridCommentsLog").DataKeys(dataKeys => dataKeys.Add(o => o.QuoteID)).ToolBar(commands => { commands.Insert().ButtonType(GridButtonType.Image); commands.SubmitChanges().ButtonType(GridButtonType.Image); }).DataBinding(dataBinding => dataBinding.Ajax().Select("GetCommentsLogDetails", "InventoryHome").Update("SaveCommentsLog", "InventoryHome")).Columns(columns =>
{
columns.Bound(o => o.QuotesCommentsLogID).Title("QuotesCommentsLogID").Hidden(true);
columns.Bound(o => o.QuoteID).Title("QuoteID").Hidden(true);
columns.Bound(o => o.LogUserName).Title("User").Width(40).ReadOnly(true);
columns.Bound(o => o.LogDateTime).Title("Date").Width(120).ReadOnly(true);
columns.Bound(o => o.Comments).Title("Comments");
columns.Command(commands => commands.Delete().ButtonType(GridButtonType.Image)).Title("Delete");
}).RowAction(row =>
{
// "DataItem" is the Order object to which the current row is bound to
if (row.DataItem.QuotesCommentsLogID != null)
{
//Set the background of the entire row
row.HtmlAttributes["disabled"] = "disabled";
}
}).CellAction(cell =>
{
if (cell.Column.Title == "Delete")
{
cell.HtmlAttributes["style"] = "visibility:hidden";
}
}).ClientEvents(events => events.OnEdit("onEdit")).Editable(editing => editing.Mode(GridEditMode.InCell).DefaultDataItem(new QuotesCommentsLogModel { LogUserName = SessionHandler.UserName, LogDateTime = DateTime.Now.ToShortDateString() })).Pageable(paging => paging.PageSize(10).Style(GridPagerStyles.NextPreviousAndDropDown)).Selectable().HtmlAttributes(new { style = " font-family:arial; font-size: .7em; width:800px;" })
</td>
</tr>
</table>
We are experiencing the following issue while using the Delete button column in the Grid
We need to have a Delete column in the grid to delete the row. But Unfortunately, when I add the delete command, my grid getting splitted. Kindly provide us the right direction as soon as possible. Here is the code on creating/binding grid:
<table style="height:100%;">
<tr>
<td colspan="5">
@Html.Telerik().Grid(CommentsLog).Name("gridCommentsLog").DataKeys(dataKeys => dataKeys.Add(o => o.QuoteID)).ToolBar(commands => { commands.Insert().ButtonType(GridButtonType.Image); commands.SubmitChanges().ButtonType(GridButtonType.Image); }).DataBinding(dataBinding => dataBinding.Ajax().Select("GetCommentsLogDetails", "InventoryHome").Update("SaveCommentsLog", "InventoryHome")).Columns(columns =>
{
columns.Bound(o => o.QuotesCommentsLogID).Title("QuotesCommentsLogID").Hidden(true);
columns.Bound(o => o.QuoteID).Title("QuoteID").Hidden(true);
columns.Bound(o => o.LogUserName).Title("User").Width(40).ReadOnly(true);
columns.Bound(o => o.LogDateTime).Title("Date").Width(120).ReadOnly(true);
columns.Bound(o => o.Comments).Title("Comments");
columns.Command(commands => commands.Delete().ButtonType(GridButtonType.Image)).Title("Delete");
}).RowAction(row =>
{
// "DataItem" is the Order object to which the current row is bound to
if (row.DataItem.QuotesCommentsLogID != null)
{
//Set the background of the entire row
row.HtmlAttributes["disabled"] = "disabled";
}
}).CellAction(cell =>
{
if (cell.Column.Title == "Delete")
{
cell.HtmlAttributes["style"] = "visibility:hidden";
}
}).ClientEvents(events => events.OnEdit("onEdit")).Editable(editing => editing.Mode(GridEditMode.InCell).DefaultDataItem(new QuotesCommentsLogModel { LogUserName = SessionHandler.UserName, LogDateTime = DateTime.Now.ToShortDateString() })).Pageable(paging => paging.PageSize(10).Style(GridPagerStyles.NextPreviousAndDropDown)).Selectable().HtmlAttributes(new { style = " font-family:arial; font-size: .7em; width:800px;" })
</td>
</tr>
</table>