or
1.
@Html.Kendo().ComboBox()
2.
.Suggest(true)
3.
.HighlightFirst(true)
4.
.BindTo(dataSource)
5.
.Value("someValue")
@(Html.Kendo().Grid<
KendoGridAjaxEditing.Models.RoleViewModel
>()
When I run and access my page with the Kendo Grid, I get the following error message:
Compiler Error Message: CS0246: The type or namespace name 'KendoGridAjaxEditing' could not be found (are you missing a using directive or an assembly reference?)
I have searched the documentation and cannot find the namespace to resolve error message. I appreciate the assistance in resolving this error.
<%= Html.Kendo().Chart(Of MyNamespace.DateIntPair) _
.Name(
"chart"
) _
.Legend(
False
) _
.DataSource(
Function
(ds) ds.Read(
Function
(read) read.Action(
"GetStatsUniqueViews"
,
"Home"
,
New
With
{.id = RouteData.Values(
"id"
)}))) _
.Series(
Function
(series) series.Area(
Function
(model) model.IntValue)) _
.CategoryAxis( _
Function
(axis) axis.Categories(
Function
(model) model.DateValue).
Date
().BaseUnit(ChartAxisBaseUnit.Days)))
%>
(Html.Kendo().Grid(Model.TPOrderDetails)
.Name("Grid")
//.HtmlAttributes(new { style = "height: 750px; width: 1000px; "})
.ToolBar(toolBar => toolBar.Template(
@<
text
>
<
label
>Plant Personnel:</
label
>
@Html.DropDownList("PersonnelID", (SelectList)ViewData["PersonnelList"])
@item.CustomCommandToolBarButton("assignWork", "Assign", "AssignOrders", "Production", null, new { id = "assignButton", @class="btn-success" })
@item.CustomCommandToolBarButton("unassignWork", "Clear Assignment", "UnassignOrders", "Production", null, new { id = "unassignButton", @class = "btn-error"})
@item.CustomCommandToolBarButton("clearSelections", "Clear Selections", "ClearSelections", "Production", null, new { id = "clearSelections", @class="btn-warning"})
@item.CustomCommandToolBarButton("refreshGrid", "Refresh", "RefreshGrid", "Production", null, new { id = "refreshGrid", @class = "btn-success"})
</
text
>
)
)
.Columns(columns =>
{
columns.Bound(p => p.RequestedShipDate).Format("{0:d}").Hidden(true);
columns.Bound(p => p.ContainerSize);
columns.Bound(p => p.SystemNumber);
columns.Bound(p => p.CustomerName);
columns.Bound(p => p.Order_ID).Groupable(false).Visible(false);
columns.Bound(p => p.CreditApproval)
.Template(@<
text
>
@Html.CheckBox("test", false);
</
text
>)
.ClientTemplate("<
input
type
=
'checkbox'
#= CreditApproval ?
checked
=
'checked'
:'' #
class
=
'input-checkbox'
disabled
=
'disabled'
/>")
.Title("Approved");
columns.Bound(p => p.AssignedPersonnel).Title("Assigned");
})
.Groupable()
.Pageable(pager =>
pager.Refresh(true))
.Sortable()
.Filterable()
.Selectable(selectable => {
selectable.Mode(GridSelectionMode.Multiple);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Read(read => read.Action("Orders_Read", "Production"))
.Sort(sort =>
{
sort.Add("ContainerSize");
sort.Add("SystemNumber");
})
.Group(group =>
{
group.Add("RequestedShipDate", typeof(DateTime?));
})
)
$("#Grid").delegate('tbody >tr', 'click', function () {
$(this).toggleClass('k-state-selected');
});
function assignProductionWork()
{
var selection = getGridSelectedItems('#Grid');
var personnelID = $('#PersonnelID').val();
$.ajax({
type: "POST",
url: "/Production/AssignOrders",
data: JSON.stringify({ personnelID: personnelID, items: selection }),
dataType: "html",
contentType: "application/json; charset=utf-8",
success: function (data) {
refreshGrid();
},
error: function () {
alert('Unable to assign production!');
}
});
}
function unassignProductionWork()
{
var selection = getGridSelectedItems('#Grid');
$.ajax({
type: "POST",
url: "Production/UnassignOrders",
data: JSON.stringify({ items: selection }),
dataType: "html",
contentType: "application/json; charset=utf-8",
success: function (data) {
refreshGrid();
},
error: function() {
alert('Unable to clear work assignments.');
}
});
}
function getGridSelectedItems(gridid)
{
var grid = $(gridid).data("kendoGrid");
var selection = [];
grid.select().each(
function () {
var dataItem = grid.dataItem($(this));
selection.push(dataItem);
}
);
return selection;
}
@(Html.Kendo().Grid(Model)
.Name(
"Adressen"
)
// Datasource
.DataSource(dataSource => dataSource
.Ajax()
.AutoSync(
true
)
.PageSize(250)
.Model(model =>
{
model.Id(p => p.Eadr);
model.Field(p => p.Eadr).Editable(
false
);
model.Field(p => p.BaLand).DefaultValue(
new
LiCPSAdmin2.Models.BaLand());
})
.Events(events => events.Error(
"adressen_error_handler"
))
.Create(create => create.Action(
"Create"
,
"Adressen"
))
.Read(read => read.Action(
"Read"
,
"Adressen"
))
.Update(update => update.Action(
"Edit"
,
"Adressen"
))
.Destroy(destroy => destroy.Action(
"Delete"
,
"Adressen"
))
)
//Columns
.Columns(columns =>
{
columns.Command(command =>
{
command.Edit().Text(
" "
);
command.Custom(
" "
).Click(
"adressen_delete_handler"
).HtmlAttributes(
new
{ name =
"btn_delete"
});
}).Width(90).HtmlAttributes(
new
{ style =
"background-color: rgb(238, 238, 238)"
});
columns.Bound(p => p.Eadr).Width(90).HtmlAttributes(
new
{ style =
"text-align:center;"
});
columns.Bound(p => p.Nama);
columns.Bound(p => p.Namb);
columns.Bound(p => p.Namc);
columns.Bound(p => p.Namd);
columns.Bound(p => p.Name);
columns.Bound(p => p.Namf);
columns.Bound(p => p.Pstc).Width(90).HtmlAttributes(
new
{ style =
"text-align:center;"
});
columns.Bound(p => p.Ccty).Width(90).HtmlAttributes(
new
{ style =
"text-align:center;"
});
columns.Bound(p => p.BaLand.Dsca)
.Width(200)
.ClientTemplate(
" #= BaLand ? BaLand.Dsca : '' # "
)
.Filterable(f => f.UI(
"statesFilter"
));
})
// Events
.Events(events => events.Edit(
"adressen_edit_handler"
)
.DataBound(
"adressen_bound_handler"
))
// Options
.ToolBar(toolbar => toolbar.Create().HtmlAttributes(
new
{ enabled =
"false"
}))
.Editable(editable => editable.Mode(GridEditMode.InLine).DisplayDeleteConfirmation(
false
))
.Pageable()
.Sortable()
.Filterable(filter => filter.Extra(
false
))
.Scrollable(scrollable => scrollable.Virtual(
true
))
.HtmlAttributes(
new
{ style =
"height:100%;"
})
.Resizable(resize => resize.Columns(
true
))
.ColumnResizeHandleWidth(5)
.Reorderable(reordering => reordering.Columns(
false
))
)
function
adressen_delete_handler(e) {
e.preventDefault();
var
grid =
this
;
var
row = $(e.currentTarget).closest(
"tr"
);
$(
"#delete_confirmation_popup"
).css({
'top'
: ($(row).position().top + 157 + ($(row).height() / 2)),
'margin-left'
: (86)}).fadeIn();
$(
"#btn_yes"
).off().on(
'click'
,
function
() {
grid.removeRow(row);
$(
"#delete_confirmation_popup"
).fadeOut();
});
$(
"#btn_no"
).off().on(
'click'
,
function
() {
grid.cancelChanges();
$(
"#delete_confirmation_popup"
).fadeOut();
});
};
@model PASS.ViewModels.Proposals.RequiredViewModel
@using (Ajax.BeginForm("Required", "Proposals", new AjaxOptions { UpdateTargetId = "requiredReturnMsg", HttpMethod = "Post" }))
{
@Html.HiddenFor(model => model.Proposal_ID, Model.Proposal_ID)
<
div
class
=
"editor-container"
>
<
div
class
=
"editor-label"
>
@Html.Label("Funding Source")
</
div
>
<
div
class
=
"editor-field"
>
@Html.DropDownListFor(model => model.Funding_Source_ID, new SelectList(Model.FundingSources, "Value", "Text"), "(Select One)")
@Html.ValidationMessageFor(model => model.Funding_Source_ID)
</
div
>
<
br
class
=
"clear"
/>
<
div
class
=
"editor-label"
>
@Html.Label("Specify (only if requested)")
</
div
>
<
div
class
=
"editor-field"
>
@Html.TextBoxFor(model => model.Funding_Specify, new { style = "width: 350px;" })
@Html.ValidationMessageFor(model => model.Funding_Specify)
</
div
>
<
br
class
=
"clear"
/>
<
br
/>
<
br
/>
<
p
><
input
type
=
"submit"
value
=
"Add Funding Source"
/></
p
>
<
br
/>
<
br
/>
@Html.Action("FundingSources", "Proposals", new { proposalID = Model.Proposal_ID })
<
br
/>
<
br
/>
<
div
id
=
"requiredReturnMsg"
></
div
>
</
div
>
}
@model IEnumerable<
PASS.ViewModels.Proposals.FundingSourcesViewModel
>
@using (Ajax.BeginForm("FundingSources", "Proposals", new AjaxOptions { }))
{
<
div
style
=
"width:95%;"
>
@(Html.Kendo().Grid(Model)
.Name("gvFundingSources")
.Columns(columns =>
{
columns.Bound(o => o.FundingSourceDescription).Title("Funding Source");
columns.Bound(o => o.Funding_Specify).Title("Specifics");
columns.Command(command => { command.Destroy(); }).Width(50);
})
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(o => o.ID))
.Read(read => read.Action("FundingSources", "Proposals"))
.Destroy(destroy => destroy.Action("DeleteFundingSource", "Proposals"))
)
)
</
div
>
}
public ActionResult Required(int proposalID)
{
var context = new PASSEntities();
RequiredViewModel model = new RequiredViewModel
{
Proposal_ID = proposalID,
FundingSources = context.Funding_Sources.ToList().Select(m => new SelectListItem { Value = m.ID.ToString(), Text = m.Description }).ToList()
};
return PartialView(model);
}
[HttpPost]
public ActionResult Required(RequiredViewModel model)
{
try
{
var context = new PASSEntities();
var fundingsource = context.Proposal_Funding_Sources.Find(model.ID);
bool bAdd = false;
if (fundingsource == null) {
fundingsource = new Proposal_Funding_Sources();
bAdd = true;
}
fundingsource.Funding_Source_ID = model.Funding_Source_ID;
fundingsource.Proposal_ID = model.Proposal_ID;
fundingsource.Funding_Specify = model.Funding_Specify;
if (bAdd) context.Proposal_Funding_Sources.Add(fundingsource);
else context.Entry(fundingsource).State = System.Data.EntityState.Modified;
context.SaveChanges();
var message = new SystemMessage(Models.eMessageType.SUCCESS);
message.Message = "Your data has been saved!";
return PartialView("_SystemMessage", message);
}
catch
{
var message = new SystemMessage(Models.eMessageType.ERROR);
message.Message = "Save Failed!";
return PartialView("_SystemMessage", message);
}
}
[ChildActionOnly]
public ActionResult FundingSources(int proposalID)
{
var context = new PASSEntities();
var model = (from a in context.Proposal_Funding_Sources
join b in context.Funding_Sources on a.Funding_Source_ID equals b.ID
where a.Proposal_ID == proposalID
select new FundingSourcesViewModel()
{
ID = a.ID,
Proposal_ID = a.Proposal_ID,
Funding_Source_ID = a.Funding_Source_ID,
Funding_Specify = a.Funding_Specify,
FundingSourceDescription = b.Description
});
return PartialView(model);
}
[HttpPost]
[ChildActionOnly]
public ActionResult DeleteFundingSource(int id)
{
try
{
using (PASSEntities context = new PASSEntities())
{
var fundingsource = context.Proposal_Funding_Sources.Find(id);
context.Entry(fundingsource).State = System.Data.EntityState.Deleted;
context.SaveChanges();
}
var message = new SystemMessage(Models.eMessageType.SUCCESS);
message.Message = "Your data has been saved!";
return PartialView("_SystemMessage", message);
}
catch
{
var message = new SystemMessage(Models.eMessageType.ERROR);
message.Message = "Save Failed!";
return PartialView("_SystemMessage", message);
}
}