Sat. Dec 7th, 2019

Host your Website

Read and learn

FatCow Web Hosting $1.00/mo* Trust your web hosting to the #1 web host provider, GoDaddy!

Generate HYPERLINKS Using ACTIONLINK Html Helper | ASP.NET MVC Application- Part 8

1 min read



Hello , In this video you will be able to generate hyperlinks using Actionlink html helper for edit,delete,redirect operation. You can use simple html tag or Html helper object to create Hyperlinks and buttons dynamically.You can use bootstrap classes to make Hyperlink to look like button.Please watch bootstrap Tutorial if u are new to bootstrap.See recommendation below.

SOCIAL :

Like TechnoTips official Page : http://facebook.com/technotipstutorial
Subscribe : http://youtube.com/user/aapkanigam

VISIT OUR BLOG:
http://technotipstutorial.blogspot.com

INTRODUCTION :

Below are the few point that need to keep in mind.

1.Razor is not a programming language. It’s a server side markup language.
2.Razor lets you embed server-based code (Visual Basic and C#) into web pages.
3.Razor code blocks are enclosed in @{ … }
4.Inline expressions (variables and functions) start with @
5.Code statements end with semicolon
6.Variables are declared with the var keyword

In Razor we mainly use following things
a. Objects
b. Conditional Statements (If & else)
c. Looping

RECOMMENDATION :

Watch Bootstrap Video :
1.Bootstrap Navigation bar : https://www.youtube.com/watch?v=FwqcoXMwgQU

TAGS :
how to create a – website
asp. net mvc
asp.net mvc interview questions
asp .net mvc tutorial
asp. net mvc 4
asp.net mvc 5 tutorial
asp net mvc developer
asp net mvc continuous integration
asp net mvc hosting
model view controller
jquery-ajax
$ ajax jquery
jquery ajax tutorial
viewbag
$controller
$model
razor view engine
$how

10 thoughts on “Generate HYPERLINKS Using ACTIONLINK Html Helper | ASP.NET MVC Application- Part 8

  1. Hi Ashish, I had a problem with the @Html.ActionLink I'm using Visual Studios 2017 and here is the code I used @Html.ActionLink(item.Name, "EmployeeDetail", new { EmployeeID=item.EmployeeID }, new { @class="btn btn-block btn-primary" }) This is the error I received Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1973: 'HtmlHelper<dynamic>' has no applicable method named 'ActionLink' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

    Line 18: @*<a class="btn btn-block btn-primary" href="/Test/[email protected]"> @item.Name</a>*@

    Line 19:

    Line 20: @Html.ActionLink(item.Name, "EmployeeDetail", new { EmployeeID=item.EmployeeID }, new { @class="btn btn-block btn-primary" })

    Line 21:

    Line 22: </li>

    What is wrong?

  2. i cant understand where you create Employeeviewmodel as custom table ,because is in your database there only two tables,
    you are going well i.e help us to improve but you must show each step where and how you create this ,

  3. Can you make a video or give me hints how to retrieve all data using Department Hyperlink .
    Like a fetch data of Department .
    CSE
    EEE
    ARCHI
    now when I click on CSE ,it'll show me all CSE students .
    How can I do it?

  4. Sir, HI. Please I have a database in which employee Id is customized of type string, How do I view the employee details by fetching it using SingleOrDefault. Trying to use the same line from your tutrial but it is not working yet. Please help me! Thanks

  5. My face is red for not finding this and I thought I had searched and searched. I need to learn more about debugging and how to use it. Thank you Ashish, that answer came really quick.

  6. When I run the Index.Cshtml code the buttons work and direct me to the correct details page.
     <a class="btn btn-block btn-primary " href="/Test/EmployeeDetail
    [email protected]">@item.Name</a>

    When I run the Html helper code I get errors and page does not load.
    @Html.ActionLink(item.Name, "EmployeeDetail", new {EmnployeeId = item.EmployeeId},
    new { @class= "btn btn-block btn-primary" })

    I recieve this error in the browser. Does anyone have suggestion as to what is wrong?

     Server Error in '/' Application.The parameters dictionary contains a null entry for parameter 'EmployeeId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult EmployeeDetail(Int32)' in 'MVCTutorial.Controllers.TestController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
    Parameter name: parameters Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: The parameters dictionary contains a null entry for parameter 'EmployeeId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult EmployeeDetail(Int32)' in 'MVCTutorial.Controllers.TestController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
    Parameter name: parameters

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Comments are closed.

Copyright © All rights reserved. | Newsphere by AF themes.