MVC action returning just viewbag result
I’m new to MVC 5.
I’m new to MVC 5.
This is related to a previous question on passing model data to a partial view from two DropDownLists where the user must select department and year in a view. Numerical data is then displayed in a table in the partial view. The view contains the dropdowns and the table headers. The partial view contains the rows with the numerical data. Right now, the validation is broken. Both dropdowns are required. If I submit form with either dropdown not selected, I get this error:
The problem I am facing with my Console App that is running in Microsoft Azure WebJobs is that HttpContext.Current is not evaluating to null. In other words, When I do the following, UserID is read from HttpContext.Current.User.Identity.GetUserId(), which evaluates to “”.
I have a table of records being displayed in a partial view and some of them have no ID values. So I am trying to use an alternative field as an ID when clicking the Edit link for a particular record. I’m not sure if I can legally have two Post action methods, even though I am using different methods names and params.
I have 3 types of user in my application(in asp.net mvc-5): Admin, Doctor and User. In Models folder I’ve created 3 other folder, one for each type of user. Should I create a single ViewModel, suppose DoctorViewModel which will carry all information about doctor? Or should I create DoctorLoginViewModel and DoctorRegistractionViewModel and so on?
I’m building a view which will display tabular data based on selections from two dropdownlists, the first which selects departments is populated from the database. The second is a static dropdownlist for “Year” which I haven’t got to yet. There are answers to similar questions, but I’ve looked at them and tried everything. I’ve got to the point where I’m getting a null exception in the view where I created the markup for the dropdownlist.
For a project i’ve been trying to upload a file from my view to my controller action.
However, for some reason the action is reached but for the file i receive a null.
I’ve got a View rendering two dropdownlists. The controllers for the dropdownlists work fine. They call methods in a repository class for the DB selections. Below the dropdownlists I’m trying to render a table of data in a partial view, in response to the dropdownlist selections.
In my asp.net project I’m using a ViewModel called DoctorLoginViewModel.cs which is used for rendering the Login view.
I was wondering if this ViewModel can be used in login ActionMethod
This is related to an earlier question on binding a dropdownlist from a database. The dropdownlist is being bound and populated but is throwing an “Object reference not set to an instance of an object” error in the browser when submitting the form.