The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern. The latest release of the framework offers REST-style web services development capability, also known as Web API.
0
votes
0answers
2 views
Mapping From MultiSelect Option List to Knockout ViewModel to ASP.NET MVC
I am struggling with an issue of how to map my Knockout ViewModel so that it will submit correctly back to my Controller and will automap. I have it partially working, but my model contains a list ...
0
votes
0answers
3 views
How do I edit a row that already exists
I'm adding a row to Videos and then I want to use that same ID as the video's physical filename. so I need to add the row without the filename, and then use the ID I get, then update that row with the ...
0
votes
1answer
8 views
Migrations based DatabaseInitializer not working on a host
I have a DbInitializer set in my MVC applicaton:
public class CreateAndMigrateDatabaseInitializer<TContext, TConfiguration>
: CreateDatabaseIfNotExists<TContext>, ...
0
votes
1answer
9 views
How to edit only few fields on the model using Kendo UI listview?
I have a Kendo UI List View that is bound to a datasource. There is a model class that has fields such as {Id, Name, Description, IsActive and so on). I followed the Kendo UI Listview demo and added ...
2
votes
10answers
77 views
Operator '>' cannot be applied to operands of type 'string' and 'string' in query
In my table I have this field:
public string CARD_MANA_CONVT { get; set; }
It is a numerical field written as a string. Yep. Because in 95% of the time the value is an int, and the remaining 5%, it ...
0
votes
2answers
26 views
How to preserve the current css class state of an element such as a div?
I'm trying to learn and create a website in using asp.net mvc and I am now confused compared to using webforms. So,
I have 2 divs.
div1 contains an unordered list, which is used as the navigation ...
0
votes
0answers
47 views
Checking for Model Errors in Entity Framework
In my controller, I have an action that takes in 3 arguments (primary_key, property, and value) and uses reflection to set the value on corresponding model. (Found by its primary key)
I thought I ...
0
votes
1answer
28 views
In an action can I select a partial view to include in my view?
I have an action that receives the result of a radio button selection. From that I want to select which partial view to render in the resulting view.
i.e.
if radiobutton =1
render view with ...
0
votes
1answer
28 views
EF5 MVC4 Child/Parent navigation properties
I have 3 classes that can be the child of a multitude of parent classes. Is there a way to find the ID/Type of the child's parent class without adding a navigation property for every possible parent ...
-1
votes
4answers
43 views
Replacing enum values with something meaningful
I have an enum which i use in my app as follows:
public enum TaskStatus{
WaitinForApproval,
SubmittedForReview,
.....
}
When i display this on the page it displays :
...
0
votes
0answers
7 views
How to hide MvcSiteMapNode from menu but not breadcrumbs?
I have a certain page which I don't want showing up in the menu. However, when I am on the page, I do want it to show up in the breadcrumbs.
I'm trying to do this with an ...
0
votes
0answers
10 views
How to handle route constraint while also using [Authorize] attribute
I have a situation in which I'm interested in how other people handle. I have defined a custom AuthorizeAttribute as follows:
public class AuthorizeActiveDirectory : AuthorizeAttribute
{
public ...
0
votes
4answers
45 views
Check to see if row exists before adding it?
I have a Certification process. Right now it will add people to my Certification table even if they already are certified for the item in question.
On my view page, I have a procedureID and there ...
0
votes
0answers
44 views
Way to force User to Enter Password in MVC to perform certain Actions
I have a CRUD model in a MVC project. However I am trying to make a User enter his password even if the User is Authenticated when performing certain Actions.
[HttpPost]
[ValidateAntiForgeryToken]
...
1
vote
1answer
32 views
Asynchronous HttpModule MVC
I have a synchronous HttpModule that contains the following code.
/// <summary>
/// Occurs as the first event in the HTTP pipeline chain of execution
/// when ASP.NET responds to ...
0
votes
2answers
9 views
CKEditor - move skins folder somewhere else
I'm using CKEditor for the first time and trying to do something that I thought would be very simple to do but so far I've had no success.
Essentially I want to place the editor.js, config.js and ...
0
votes
1answer
28 views
How to identify which IIS server reponding my http page request?
My website is placed in 8 different IIS servers and controlled using load balancer.
When i request any page, I would like to identify which IIS server (IP or domain name)responds the request?
How to ...
0
votes
2answers
9 views
System.Web.UI.DataVisualization assembly not found in view
I know this question has been asked a lot in different forums, but I did everything they said and it's still not working for me.
I have an ASP.NET MVC application in FRAMEWORK 4.0, in VisualStudio ...
0
votes
5answers
38 views
Get a text item from an c# SelectList
Using Visual Studio Express 2012 for Web and Razor, I create a select list:
List<SelectListItem> list = new List<SelectListItem>();
list.Add(new SelectListItem { Text = "Yes", Value = "1" ...
0
votes
3answers
36 views
Button onclick inside whole clickable div
I have a whole clickable div.
This is my code:
<div onclick="location.href='@Url.Action("SubClass", "Product", new { id = productClass.HierarchyId })';" class="menu-class">
<img ...
0
votes
1answer
29 views
Content() function usage in asp.net mvc
I am new in mvc and am still reading about it. I am interested to know about the Content() function in great detail. Could you give me a sample for using this Content() function in mvc?
If Content() ...
1
vote
1answer
30 views
Referencing a class that inherits from another class
I am creating a library and i am referencing from class Main which inherits from Body
public class Main:Body
i added Main to my using references but when i go to initiate an instance - i tried:
...
0
votes
0answers
8 views
Webgrid column condition combined with multiline
I'm trying to create a multiline inside a cell if a certain condition is fullfilled. In my else structure I have to 'return' one string, but i have no idea how to get this to work.
Here is some code
...
0
votes
1answer
28 views
Mail alert with new insert in mvc database
How can I send an email alert to my gmail when there is a new entry into a table in the database. My project including database is in MVC4. I have tried the syntax below, but I get the error:
...
1
vote
3answers
31 views
how to work with two forms in a single view
Can I add more than one form in a single view , how to work with it. Can this be done using only one model or do I need to use different models for different forms. Can any one explain me with a good ...
0
votes
2answers
50 views
not able to get values in second dropdownlist in a view
I have got cascaded dropdown list to show items in second drop downlists regarding the selected ones in first drop downlist for that purpose I have done like this....
code for Controller
namespace ...
2
votes
2answers
47 views
How to show all images from my database?
im working on a project in MVC 4 visual studio. and what im trying to do is select all images from my database and show all in my view.
In my database i have 3 columns:
id | FileTitle | FilePath
...
3
votes
4answers
63 views
Why doesn't Web API Controller with LINQ To SQL and “using” statement work?
Team,
I like to wrap my data access in using statements to make myself feel good about garbage collection. I am running Visual Studio 2013 (beta) with .Net 4.5. I have an ApiController called ...
0
votes
1answer
16 views
Asp.Net MVC Dynamic Model Binding Prefix
Is there any way of changing the binding prefix with a value which comes from the request parameters?
I have many nested search popups, and all of them shares the same ViewModel.
I can add a binding ...
0
votes
1answer
22 views
Default model binder not working
I'm a beginner and I don't know what I'm doing wrong here. In my controller attempt, the Numbers object doesn't have values while FormCollection shows that numbers are posted correctly.
Model
...
-1
votes
0answers
22 views
Optionlable with dropdownlist
I want to remove spaces from text of dropDownList.
When user selects '8 ball' from a dropDownList, it appears with spaces in selectListItem.Text.
I need to remove those spaces from text on selection ...
1
vote
2answers
32 views
File upload using ajax request
I am trying to upload image, using ajax. i am sending request like this:
@using (Ajax.BeginForm("SaveReferral", "ReferralIM", new AjaxOptions
{
HttpMethod = "POST",
OnSuccess = ...
1
vote
2answers
24 views
AJAX Posting ValidateAntiForgeryToken without Form to MVC Action Method
I've been looking at examples of how to do this on SO and as far as I can tell I've tried all the examples I can find with no success so far. I've tried altering some of the implementations to my ...
1
vote
1answer
25 views
Purpose of namespace section in web.config in the root folder
So I understand that namespaces defined in ~/Views/web.config will add those namespaces for all views. But why is there also a namespace section in ~/web.config in the root folder`?
0
votes
2answers
21 views
How to check TempData value in my view after a form post?
I fill my TempData from a FormCollection and then I try to check the value of my TempData in my view with MVC 4 but my if statement isn't working as I except. Here is my code.
In my controller :
...
1
vote
2answers
34 views
How to create html table from model class
I am new in MVC and learning MVC. Now I do not want to use any grid extension, rather I want to generate tabular UI just by HTML table. So I was looking for code and found a hint.
This code is not ...
0
votes
1answer
32 views
MVC: Set action name using javascript fails
I need to set the action a form posts to using javascript. I tried to do this:
$('form').get(0).setAttribute('action', formAction);
and
$("#form").attr('action', formAction);
In both cases, ...
0
votes
1answer
13 views
Why asp.net model binder can not map a string values to a Object property that have the same name
I have a model class named Server and I have created a new ServerToEdit viewModel class, as follow:-
public class ServerToEdit
{
public Server Server { get; set; }
[Required]
...
0
votes
1answer
22 views
Drop down / SelectListItem in ViewModel MVC
I am new to MVC and have been told not to use SelectListItem in the View as its untidy. I was advised to put it in the Model and then pass to the view.
I have no idea whether my code in the Model is ...
1
vote
3answers
30 views
Adding a controller to edit profiles
I am currently writing a small intranet page. It displays employees and their basic details in a list using entity framework to interact with my DB and create an "Employee" class. I am adding logic ...
0
votes
1answer
21 views
how to reference different projects in one solution and access through link in MVC4
I have two projects in one solution one is company.admin and other is company.web, now I want to link these two for example if I write http://localhost60693.com/web then company.web view should be ...
0
votes
1answer
23 views
Calling Webservice asynchoronously using ajax
I have build a webservice using asp.net in C# and that's running on say
"http://ABC.com/WebSite1/Service.asmx" and I'm trying to consume this service from another asp.net website page using jquery ...
2
votes
2answers
66 views
Why does this not display the display name?
I'm trying to display the displaynames for the properties in my html in my ASP.NET MVC 4 application.
However even though I've set the displaynames in the viewmodel the raw variable names still gets ...
1
vote
0answers
15 views
web api call from code behind
i am very new to mvc web api
I have crated a web api Post method which takes an object type "Bag" and return a HTMLString the code is as shown bellow
public HtmlString PostBag(Bag bagofItem)
{
...
0
votes
1answer
29 views
ASP.NET cache memory saving code
I am trying to create a site view counter for my ASP.NET-4.0 MVC-4 website. For this, what I am doing is:
I am storing the User's IP address in asp.net cache. And when the cache expired, I will do a ...
1
vote
0answers
18 views
How to retrieve properties from ASP.NET Membership, Profile?
In web.config i defined the property:
<profile>
<properties>
<add name ="Creator" type ="System.String"/>
</properties>
</profile>
I can set values to ...
0
votes
2answers
49 views
Why can't I check if ViewModel properties in view == null?
Simple question (Ihope), I want to check if a property in my ViewModel is null using an if statement in the View
@if(Model.AdminPractice.TimeNotes == null)
this cause's an error,
Object ...
0
votes
0answers
10 views
Creating admin users for my Intranet web application whom are not part of the Active Directory
I am working on an asp.net MVC intranet web application, which uses the company active directory users to authenticate our users. And currently there is not a user registration section for my ...
0
votes
1answer
31 views
Impersonate for one request (Asp.net MVC)
In my ASP.net MVC project I've got (among other roles) moderators and users. I want to give the moderators the option to "see current page as user".
My approach is to create a ActionFilterAttribute ...
0
votes
1answer
29 views
Not able to run another function for another button inside same view
I have got the two buttons in the same view one is working with the data to show in a label in another view and I have written the function for the button2 (adding another value), when I click on ...