ASP.NET Core Pass form values on get

Here is my cs page: using System; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace CoreRazor2.Pages { public class IndexModel : PageModel { [BindProperty] public int result { get; set; } public vo...
more »

2017-08-27 04:08 (2) Answers

Pass value outside of the BeginForm into it

I have a BeginForm to populate all properties of the model. Then I use the property values to pass the action method(Model binding). Now I have a drop down outside of the BeginForm, I want to add one more property to the model. The property value is...
more »

2017-08-19 15:08 (1) Answers

How to override the @section in MVC Razor

Please help me to fix this issue. I have two files BaseLayout.cshtml and the second one is ExtendedLayout.cshtml file for overriding the base content of HTML CSS. I need to run the extended section of extendedLayout.cshtml file if same section is pre...
more »

2017-08-16 12:08 (2) Answers

Display in mvc table days from begin job date

I'm new with MVC, I have a model with employee properties, one of the properties is public DateTime BeginJob { get; set; }. When the user create a new employee he enters the date that the employee started to work in the company. My question is how c...
more »

2017-08-12 09:08 (1) Answers

Positioning elements with CSS

I know it is dumb question, but i am struggling with following problem It is one of my menu buttons. I want div the represents icon (marked red with circle) be on the left side of the button and the text on the right (name (blue) above description ...
more »

2017-08-04 10:08 (3) Answers

Redirect Admin into layout after login in mvc

I am beginner in MVC and trying to redirect Admin into _Layout - admin.cshtml after login successfully, because I have different options in admin navbar. I have logged in and redirect the layout into _Layout - admin.cshtml successfully. But, when I c...
more »

2017-08-03 13:08 (3) Answers

Using tag-helper validation for list items

I've seen this question, which seems to cover exactly what I want to do, but for some reason the solution presented there doesn't work for me. I have in my view the following: @model ExerciseEditModel @foreach (var item in Model.Rounds) { <...
more »

2017-08-01 15:08 (1) Answers

Url.Action can't find controller

I have an Html helper that defines a textbox used to feed a jquery-ui autocomplete. @Html.TextBox("txtSearchArg") The javascript is in the /Scripts folder. $("#txtSearchArg").autocomplete({ source: function (request, response) { ...
more »

2017-07-28 22:07 (1) Answers

ValueTuple not working in Razor views with MVC 5

I have an ASP.NET MVC 5 project in Visual Studio 2017 and after successfully adding C# 7 support (which has worked for me so far), I tried using tuples in my Razor views, but I got a surprising error message: CS0433: The type 'ValueTuple<T1, T2&g...
more »

2017-07-26 20:07 (1) Answers

Certain Razor views not publishing

Using VS 2017 with MVC 5 Razor views. When I publish my application, a handful of specific views do not get copied over. I'd discovered several SE questions on this same issue from back in the 2010-2011 timeframe. At the time, the issue was that B...
more »

2017-07-25 17:07 (1) Answers

Actionlink to another view (MVC)

i am working on my MVCOnlineShop Project , i have shown categories on homepage by creating a partial view CategoryLayout.cshtml : @model IEnumerable<MVCOnlineShop.Models.Category> @{ ViewBag.Title = "CategoryLayout"; } <ul class="nav na...
more »

2017-07-20 13:07 (2) Answers

System Web HttpException (Renderbody) in MVC

i am building an online shop in MVC and now working on its design, i downloaded like 2 bootstraps , and tried each one, i copied the index to my _layout.cshtml , and after running the project i am getting this error : System.Web.HttpException: The "...
more »

2017-07-13 08:07 (2) Answers

TextBoxFor decimal

In my database I stored fields with the data type decimal. I am using exactly the same (decimal) data type in my ASP.NET application. This is inside my view in order to display the value. @Html.TextBoxFor(model => model.Stock, new { id = "Stock"...
more »

2017-07-12 15:07 (3) Answers