ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Compilation error rendering popup for inline delete
Title:
B
I
{code}
?
I think I'm following the Grid inline editing conditional example correctly but I'm getting an error when I click the X at the end of the row. The popup appears with no text, then after a few seconds I get an error window: *Compiler Error Message:* CS0246: The type or namespace name 'DeleteConfirmInput' could not be found (are you missing a using directive or an assembly reference?) *Source Error:* Line 33: Line 34: Line 35: public class _Page_Views_Shared_Delete_cshtml : System.Web.Mvc.WebViewPage<DeleteConfirmInput> { Line 36: Line 37: #line hidden* *Source File:* C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\ecf90761\cf061b90\App_Web_delete.cshtml.639c3968.jwlvyxac.0.cs Line: 35 ________________________________________ Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3130.0 Here is my view: @{ var gridID = "BudgetGrid"; var initObj = new { FundingSourceID = FundingSource.FundingSources.Test, BudgetStatusID = BudgetStatus.BudgetStatuses.Proposed }; } <form> <div class="row"> <div class="col-md-12"> @Html.InlineCreateButtonForGrid(gridID, initObj, "<i class='glyphicon glyphicon-plus'></i>Add New Record") <a href="javascript:window.print();" class="btn btn-sm btn-info print"> <i class="glyphicon glyphicon-print"></i> Print </a> <a href="javascript:window.location.href=window.location.href;" class="btn btn-sm btn-primary"> <i class="glyphicon glyphicon-refresh"></i> Reset Filters </a> </div> </div> <div class="row"> <div class="col-md-12" style="margin-top: 12px"> @Html.InitDeletePopupForGrid(gridID, "Budget") @(Html.Awe().Grid(gridID) .Mod(o => o.PageSize() .PageInfo() .Loading() .InlineEdit(Url.Action("Create", "Budget"), Url.Action("Edit", "Budget"), oneRow: true) ) .Url(Url.Action("GetRecords")) .Height(450) .PercentWidth(100) .PageSize(10) .Resizable() .LoadOnParentChange(true) .ShowGroupBar(false) .SingleColumnSort(true) .Page1OnSort(true) .Persistence(Persistence.Session) .Columns( new Column { Bind = "ID", Hidden = true } .Mod(o => o.InlineId()), new Column { Bind = "FundingSourceID", Hidden = true } .Mod(o => o.InlineId()), new Column { Bind = "PlannedFunding", Header = "Planned Funding" } .Mod(o => o.Inline(Html.Awe().TextBox("PlannedFunding"))), new Column { Bind = "BudgetStatusID", Hidden = true } .Mod(o => o.InlineId()), new Column { Bind = "Narrative", Header = "Narrative" } .Mod(o => o.Inline(Html.Awe().TextBox("Narrative"))), new Column { ClientFormat = GridUtils.InlineEditFormat(), Width = 65, CssClass = "text-center" }, new Column { ClientFormat = Html.InlineDeleteFormatForGrid(gridID), Width = 80 } ) </div> </div> </form> Here is the delete part of my controller: public ActionResult Delete(int id) { var rec = db.Budgets.Find(id); if (rec != null) { return PartialView(new DeleteConfirmInput { Id = id, Message = string.Format("Are you sure you want to delete this record?") }); } else return View(); } [HttpPost] public ActionResult Delete(DeleteConfirmInput input) { var rec = db.Budgets.Find(input.Id); db.Ops_Budgets.Remove(rec); return Json(new { input.Id }); } public ActionResult Popup() { return PartialView(); } Any ideas are appreciated!
Save Changes
Cancel
CarlF
asked at 01 Aug 2018
Answers
B
I
{code}
?
the `Delete` Action in your controller returns `PartialView(new DeleteConfirmInput ...)` which will look for `Delete.cshtml`, in our demos located in `Views/Shared`, open it and check the `@model`, my guess is the `namepspace` is incorrect probably `MvcMinSetup` instead of `YourApp`, or maybe you need to add a using. this error shouldn't happen if one follows exactly instructions at: https://www.aspnetawesome.com/learn/mvc/Installation
Save Changes
Cancel
Omu
answered at 02 Aug 2018
Found it- thanks! We'd added a new area in the project and the model and delete view hadn't been copied over to it.
at 02 Aug 2018
CarlF
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK