Click here to Skip to main content
15,884,177 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Suggestionproject definition Pin
Member 1327996126-Jun-17 17:59
Member 1327996126-Jun-17 17:59 
GeneralRe: project definition Pin
Richard MacCutchan26-Jun-17 20:56
mveRichard MacCutchan26-Jun-17 20:56 
AnswerRe: project definition Pin
ZurdoDev27-Jun-17 9:54
professionalZurdoDev27-Jun-17 9:54 
QuestionHow to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14323-Jun-17 12:41
indian14323-Jun-17 12:41 
AnswerRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
F-ES Sitecore25-Jun-17 23:01
professionalF-ES Sitecore25-Jun-17 23:01 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14326-Jun-17 8:28
indian14326-Jun-17 8:28 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
jkirkerx26-Jun-17 13:26
professionaljkirkerx26-Jun-17 13:26 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
F-ES Sitecore26-Jun-17 22:53
professionalF-ES Sitecore26-Jun-17 22:53 
There are various examples of calling controller actions via jQuery here

Useful Way to Call Controller Actions From HTML Using jQuery[^]

I don't really understand what you mean by call the cshtml and then webapi. The reason you can't call cshtml pages directly is because they are just templates, they don't contain all the information you need to render html. Let's say this is in my view

<p>Hello @Model.FirstName</p>


If I were to navigate to that view directly what would appear on the screen? The reason we call actions and not views is because actions combine all available inputs (from the Request, the Session, Databases etc) with the template held in the view to output valid HTML.

You can call a WebAPI directly from a view as long as it's via javascript. You *can* put server-side code in a view to call an API but you shouldn't, it breaks the rules of MVC. So put javascript code in Views if you must, but the only server code should be what is needed to show data from the model, eg a for loop like

@foreach(SearchResult r in Model.Results)
{
    <p>@r.Name</p>
}

GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14327-Jun-17 7:17
indian14327-Jun-17 7:17 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
Richard Deeming27-Jun-17 9:31
mveRichard Deeming27-Jun-17 9:31 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14327-Jun-17 11:55
indian14327-Jun-17 11:55 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
F-ES Sitecore27-Jun-17 22:31
professionalF-ES Sitecore27-Jun-17 22:31 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14328-Jun-17 6:40
indian14328-Jun-17 6:40 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
F-ES Sitecore28-Jun-17 22:22
professionalF-ES Sitecore28-Jun-17 22:22 
GeneralRe: How to navigate from one page to another in ASP.Net MVC and Web Api application Pin
indian14328-Jun-17 6:44
indian14328-Jun-17 6:44 
QuestionHTTP Error 500.19 - Internal Server Error Pin
indian14321-Jun-17 11:29
indian14321-Jun-17 11:29 
AnswerRe: HTTP Error 500.19 - Internal Server Error Pin
F-ES Sitecore21-Jun-17 22:41
professionalF-ES Sitecore21-Jun-17 22:41 
GeneralRe: HTTP Error 500.19 - Internal Server Error Pin
indian14322-Jun-17 7:38
indian14322-Jun-17 7:38 
AnswerRe: HTTP Error 500.19 - Internal Server Error Pin
Richard Deeming22-Jun-17 1:25
mveRichard Deeming22-Jun-17 1:25 
QuestionPosting the same form on 10 pages to a single action on a controller Pin
jkirkerx21-Jun-17 7:36
professionaljkirkerx21-Jun-17 7:36 
AnswerRe: Posting the same form on 10 pages to a single action on a controller Pin
Richard Deeming21-Jun-17 8:59
mveRichard Deeming21-Jun-17 8:59 
GeneralRe: Posting the same form on 10 pages to a single action on a controller Pin
jkirkerx22-Jun-17 12:56
professionaljkirkerx22-Jun-17 12:56 
QuestionMVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
jkirkerx19-Jun-17 11:29
professionaljkirkerx19-Jun-17 11:29 
AnswerRe: MVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
Richard Deeming19-Jun-17 11:48
mveRichard Deeming19-Jun-17 11:48 
GeneralRe: MVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
jkirkerx19-Jun-17 12:22
professionaljkirkerx19-Jun-17 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.