Click here to Skip to main content
15,904,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new at MVC. I have set up a MVC4 model: Customer.cs with ID, Code and Amt in a class structure.

I get the error:
HTML
Server Error in '/' Application.

The resource cannot be found. 
  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

 Requested URL: /Home/Input



CustomerController.vb
VB
Imports Mvc4test.Customer
Namespace Mvc4test
    Public Class CustomerController
        Inherits System.Web.Mvc.Controller

        '
        ' GET: /Customer

        Function Index() As ActionResult
            Return View()
        End Function
        Function Output() As ActionResult
            Dim Cust1 As Customer = New Customer()
            Cust1.ID = Convert.ToInt32(Request.Form("id"))
            Cust1.Code = Request.Form("code")
            Cust1.Amt = Convert.ToDouble(Request.Form("amt"))
            Return View()
        End Function
        Function Input() As ActionResult
            Dim Cust0 As Customer = New Customer()
            Cust0.ID = Convert.ToInt32(Request.Form("id"))
            Cust0.Code = Request.Form("code")
            Cust0.Amt = Convert.ToDouble(Request.Form("amt"))
            Return View()
        End Function

    End Class
End Namespace

For each "View" I did a "Build". I selected strong-typed view for each and selected "Customer".

Input.vbhtml
VB
@ModelType Mvc4test.Customer

@Code
    ViewData("Title") = "Input"
End Code

    <center><h2>Input</h2></center>
    <center><table><tr><td><br /><br /><br />
        <h5>Customer ID#</h5></td></tr><tr><td>
        @Html.TextBox("id")</td></tr><tr><td><br />
        <h5>Customer Code</h5></td></tr><tr><td>
        @Html.TextBox("code")</td></tr><tr><td><br />
        <h5>Amount</h5></td></tr><tr><td>
        @Html.TextBox("amt")</td></tr><tr><td><br /><br />

        <input type="submit" value="Input Customer Data" />
    </td></tr></table></center>



Output.vbhtml
VB
@ModelType Mvc4test.Customer

@Code
    ViewData("Title") = "View1"
End Code

<h2>View1</h2>
<div>
            ID: @Html.TextBox("id")<br />
            Code: @Html.TextBox("code")<br />
            Amount: @Html.TextBox("amt")<br />
            
            <% if (Model.Amt > 100)
               { %>
                    Priveleged Customer
            <% }
               else
               { %>
                    Normal Customer
            <%}  %>
            
    </div>
Posted

1 solution

Could you be more specific with the issue, because you are giving your code, but, I don´t have any way to know where your Views are, did you generate your views from the controllers?, check your RouteConfig.cs, be more specific, not with the problem, with the things you are doing...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900