HomeController.cs

Last post 11-07-2009 11:03 AM by deemurphy. 12 replies.

Sort Posts:

  • HomeController.cs

    11-05-2009, 8:35 AM
    • Member
      93 point Member
    • deemurphy
    • Member since 03-18-2005, 2:12 AM
    • Atlanta, GA
    • Posts 196

     I have two questions.

     

    In my MVC it seems that there are certain words that can not be used in this area:

    public

    {

     

    }

    ActionResult About()return View();

    There for can my buttons have one name, but the page and

    this area have a different name?

     

    My second question, does any one know of any place else we can get MVC templates?

     

    Thank you

    LadyDee

    Darlene D. Murphy
    deemurphy_us@yahoo.com
  • Re: HomeController.cs

    11-05-2009, 9:28 AM
    • Contributor
      6,857 point Contributor
    • gerrylowry
    • Member since 07-03-2008, 1:46 AM
    • alliston ontario canada
    • Posts 2,309

    examples based on http://www.asp.net/learn/mvc/tutorial-21-cs.aspx.

    Listing 3 - Views\Home\Index.aspx:

    <%= Html.ActionLink("Edit", "Edit", new { id=item.Id }) %>

    You could write instead

    <%= Html.ActionLink("Change the information about this move", "Edit", new { id=item.Id }) %>
    although you probably would leave it as "Edit".

    public static string ActionLink(
    this HtmlHelper htmlHelper,
    string linkText,
    string actionName,
    Object routeValues
    )

    Listing 5:

      <input type="submit" value="Create" />
    or
      <input type="submit" value="Add this new movie to the movie database" />



    If a field is a literal string that is only for display to the end user, you can put whatever you want.  In any language you wish.



    Gerry Lowry, Principal
    Ability Business Computer Services ~~ Because it's your Business, our Experience Counts!
    68 John W. Taylor Avenue
    Alliston · Ontario · Canada · L9R 0E1 · gerry.lowry@abilitybusinesscomputerservices.com

    Websites:
    http://abilitybusinesscomputerservices.com
    http://gerrylowryprogrammer.com ~~ résumé & testimonials
    http://veganoccasions.com ~~ recipes by Susan
  • Re: HomeController.cs

    11-05-2009, 9:29 AM
    • Member
      246 point Member
    • MadhavRao
    • Member since 06-07-2004, 1:12 AM
    • Mumbai
    • Posts 48

    I really didnt understood your question, can you please elaborate more. I think you missed lot of words in between

  • Re: HomeController.cs

    11-05-2009, 9:33 AM
    • Contributor
      6,857 point Contributor
    • gerrylowry
    • Member since 07-03-2008, 1:46 AM
    • alliston ontario canada
    • Posts 2,309

    MVC templates:  (your second question)

    Rob Conery at http://blog.wekeroad.com/subsonic/subsonic-mvc-templates-available-and-a-security-update/
    points to  http://www.wekeroad.com/SubSonicMVC.zip.

    Just use Google with                    MVC templates
    to find more.



    Regards,
    Gerry (Lowry)

    Gerry Lowry, Principal
    Ability Business Computer Services ~~ Because it's your Business, our Experience Counts!
    68 John W. Taylor Avenue
    Alliston · Ontario · Canada · L9R 0E1 · gerry.lowry@abilitybusinesscomputerservices.com

    Websites:
    http://abilitybusinesscomputerservices.com
    http://gerrylowryprogrammer.com ~~ résumé & testimonials
    http://veganoccasions.com ~~ recipes by Susan
  • Re: HomeController.cs

    11-05-2009, 9:49 AM
    • Member
      93 point Member
    • deemurphy
    • Member since 03-18-2005, 2:12 AM
    • Atlanta, GA
    • Posts 196

    If I put like reguest, services or something like that In the view I get an error.

     

     

    Thank you 

    Darlene D. Murphy
    deemurphy_us@yahoo.com
  • Re: HomeController.cs

    11-05-2009, 10:05 AM
    • Contributor
      6,857 point Contributor
    • gerrylowry
    • Member since 07-03-2008, 1:46 AM
    • alliston ontario canada
    • Posts 2,309

    Darlene,

    I'm going to be unavailable most of the day but I'm not the only one who answers questions here.  Many members, most who know a lot more than me can answer your questions.

    BUT, you need to help us by providing a lot more detail when you ask your question.

    Instead of "an error", show us the error; if it's an exception, show us at least the essential parts of the stack trace. 

    Show us code from your .aspx page(s) and you .cs (or .vb) pages.

    Also, provide information about your development and testing and deployment environments like what o/s, what version of visual studio, what language, what version of ASP.NET MVC, et cetera, including service pack levels.

    It's fair to say:  the better the quality of the question, the better will be the quality of the answer(s).


    Regards,
    Gerry (Lowry)

    Gerry Lowry, Principal
    Ability Business Computer Services ~~ Because it's your Business, our Experience Counts!
    68 John W. Taylor Avenue
    Alliston · Ontario · Canada · L9R 0E1 · gerry.lowry@abilitybusinesscomputerservices.com

    Websites:
    http://abilitybusinesscomputerservices.com
    http://gerrylowryprogrammer.com ~~ résumé & testimonials
    http://veganoccasions.com ~~ recipes by Susan
  • Re: HomeController.cs

    11-05-2009, 10:18 AM
    • Member
      93 point Member
    • deemurphy
    • Member since 03-18-2005, 2:12 AM
    • Atlanta, GA
    • Posts 196

    I am so sorry. 

     

    I am running Windows 7 Ultimate, Visual Studio 2008, SQL 2008 Server, ASP.NET MVC 1.0, I programm in c#.

    Hope that helps some,

    Error:

    Error 3 ; expected C:\inetpub\wwwroot\Ladydee2\LadyDee2\LadyDee2\Controllers\HomeController.cs 22 33 LadyDee2

    that is this code:

     

    {

     

    }

     

    public ActionResult Web Request()return View();

     

    Darlene D. Murphy
    deemurphy_us@yahoo.com
  • Re: HomeController.cs

    11-06-2009, 6:08 PM
    • Member
      93 point Member
    • deemurphy
    • Member since 03-18-2005, 2:12 AM
    • Atlanta, GA
    • Posts 196

    I still would like an answer to this problem.

    Can any one help.

    Thank you

    Again this is the code I am using in the sites.master is:

    <%

    { %>

     

    if (Html.IsCurrentAction(" Web Sites Request", "Home"))<li class="active"><%= Html.ActionLink("Web Sites Request", "Web Sites Request", "Home")%></li>

    <% }

     

    else { %><li><%= Html.ActionLink("Web Sites Request", "Web Sites Request", "Home")%></li>

    <% }%>

     

    I am using the following code in the HomeController.cs is :

     

    {

     

    }

    public ActionResult Web Sites Request()return View();

    I am getting the following errorr:

     

    Error 3 ; expected C:\inetpub\wwwroot\Ladydee2\LadyDee2\LadyDee2\Controllers\HomeController.cs 22 34 LadyDee2

     

    This particular page will not open and I get a 404 error:

     

    Thank you

    Darlene D. Murphy
    deemurphy_us@yahoo.com
  • Re: HomeController.cs

    11-06-2009, 7:21 PM
    Answer
    • Contributor
      4,651 point Contributor
    • levib
    • Member since 07-23-2007, 11:50 PM
    • Redmond, WA
    • Posts 796
    • AspNetTeam

    You have this in your .cs file:

    public ActionResult Web Sites Request()return View();

    If this is exactly as it appears in the file, the reason your site won't compile is that you're not using proper C# syntax.  Change this to be valid C# and the compilation errors should go away.

  • Re: HomeController.cs

    11-06-2009, 8:31 PM
    Answer
    • Contributor
      5,076 point Contributor
    • Paul Linton
    • Member since 04-30-2008, 3:16 AM
    • Posts 883

    Is what you have posted a true reflection of the code you have written? If so, I would suggest that you do a bit more basic programming before embarking on an MVC based web site as the errors you have shown are almost too numerous to list.

    Try downloading the free book in my signature and working through it.  This will give you a good grounding in c# programming.  Once you have the basic structure of a c# program, the rules concerning naming of variables and the general syntax of the basic c# operators you will be well placed to work through some of the excellent MVC tutorials available at this web site.

    Good luck in your new programming endeavours.

    Got a c# problem? Try .NET Book Zero from Charles Petzold, it's a free pdf.
  • Re: HomeController.cs

    11-06-2009, 8:37 PM
    • Contributor
      5,076 point Contributor
    • Paul Linton
    • Member since 04-30-2008, 3:16 AM
    • Posts 883

    When you post code can you use the 'Insert code' button from the toolbar?  It looks like a piece of paper with {} on it.  I suspect the code we see in your posts is not really the code that you are using.

    Got a c# problem? Try .NET Book Zero from Charles Petzold, it's a free pdf.
  • Re: HomeController.cs

    11-07-2009, 12:52 AM
    Answer
    • Contributor
      6,857 point Contributor
    • gerrylowry
    • Member since 07-03-2008, 1:46 AM
    • alliston ontario canada
    • Posts 2,309

    Darelene,

    as others have pointed out, you have quite a few errors in your code.

    either these are typos, or if you are copy and pasting, they are real errors.

    Visual Studio identifies each and every error, including line number.

    Clean up each error until you get a clean compile.

    http://forums.asp.net/37.aspx <=== Home ›  ASP.NET Forums » .NET Languages » C#

    http://forums.asp.net/1112.aspx <=== HomeASP.NET Forums » Visual Studio » Visual Studio 2008



    Regards,
    Gerry (Lowry)

    Gerry Lowry, Principal
    Ability Business Computer Services ~~ Because it's your Business, our Experience Counts!
    68 John W. Taylor Avenue
    Alliston · Ontario · Canada · L9R 0E1 · gerry.lowry@abilitybusinesscomputerservices.com

    Websites:
    http://abilitybusinesscomputerservices.com
    http://gerrylowryprogrammer.com ~~ résumé & testimonials
    http://veganoccasions.com ~~ recipes by Susan
  • Re: HomeController.cs

    11-07-2009, 11:03 AM
    • Member
      93 point Member
    • deemurphy
    • Member since 03-18-2005, 2:12 AM
    • Atlanta, GA
    • Posts 196

    I got this code from the asp.net/designs  page.  I was in the process of adding pages to it.  This is the name of the design:  Orange Tabs by jlerasmus

    Per your suggestion here is the code again:

      <div id="menucontainer">
                
                    <ul id="menu">
                    <% if (Html.IsCurrentAction("Index", "Home")) { %>
                        <li class="active"><%= Html.ActionLink("Home", "Index", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Home", "Index", "Home") %></li>
                    <% }%>
    
                    <% if (Html.IsCurrentAction("About", "Home"))
                       { %>
                        <li class="active"><%= Html.ActionLink("About", "About", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("About", "About", "Home")%></li>
                    <% }%>
                    
                                    
                    <% if (Html.IsCurrentAction(" Web Sites Request", "Home"))
                       { %>
                        <li class="active"><%= Html.ActionLink("Web Sites Request", "Web Sites Request", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Web Sites Request", "Web Sites Request", "Home")%></li>
                    <% }%>
                    
                    
                     
                    <% if (Html.IsCurrentAction("Databases", "Home"))
                       { %>
                        <li class="active"><%= Html.ActionLink("Databases", "Databases", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Databases", "Databases", "Home")%></li>
                    <% }%>
                    
                                   
                    <% if (Html.IsCurrentAction("Programming", "Home"))
                       { %>
                        <li class="active"><%= Html.ActionLink("Programming", "Programming", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Programming", "Programming", "Home")%></li>
                    <% }%>  
                   
                      <% if (Html.IsCurrentAction("Portfolio", "Home"))
                       { %>
                        <li class="active"><%= Html.ActionLink("Portfolio", "Portfolio", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Portfolio", "Portfolio", "Home")%></li>
                    <% }%>    
                       
                     <% if (Html.IsCurrentAction("Contact", "Home"))
                       { %>
                                          
                        <li class="active"><%= Html.ActionLink("Contact", "Contact", "Home")%></li>
                    <% } else { %>
                        <li><%= Html.ActionLink("Contact Me", "Contact", "Home")%></li>
                    <% }%>
                    </ul>
                
                </div>
            </div>
    


    T

    That is from the site.master page.

     

    This is from the HomeController.cs page:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
        [HandleError]
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                ViewData["Message"] = "LadyDee's Web Specialties!";
    
                return View();
            }
    
            public ActionResult About()
            {
                return View();
            }
    
            public ActionResult  Web Sites Request()
            {
                return View();
            }
    
            public ActionResult Databases()
            {
                return View();
            }
    
             public ActionResult Programming()
            {
                return View();
            }
    
            public ActionResult Portfolio()
            {
                return View();
            }
    
    
    
            public ActionResult Contact()
            {
                return View();
            }
        }
    
    

    I have taken the ASP.NET 2.0 E-Commerce in c# 2005 course and the ASP.NET 3.5 course.  I am studying for my exam in 70-536.  I am on the asp.net site quite often and wanted to learn MVC. so I download a design.

    I would also like to say thank you very much for the information on downloading your book, I want to learn as much as I can.

    Thank you


     

    Darlene D. Murphy
    deemurphy_us@yahoo.com
Page 1 of 1 (13 items)