Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:56:42+00:00 2026-06-13T23:56:42+00:00

I have a webgrid with an actionlink which I want to use to edit

  • 0

I have a webgrid with an actionlink which I want to use to edit the selected row in a new view. I know that I can use an actionlink to supply an arguement to my actionresult method but I don’t know how to pass the webgrid’s row data to my controller apart from using actionlink.

@{
    ViewBag.Title = "Index";
}
<h2>
    Index</h2>
<p>
    @Html.ActionLink("Create New User", "CreateUser")
</p>
<div class="webgrid-wrapper">
    @model IEnumerable<UserManager.Models.vw_UserManager_Model_Add_Users>
@{
    ViewBag.Title = "Jobs";
    WebGrid grid = new WebGrid(Model, canPage: true, canSort: true, rowsPerPage: 15, selectionFieldName: "selectedRow", fieldNamePrefix: "gridItem");

}
    @grid.GetHtml(
    fillEmptyRows: true,
        tableStyle: "webgrid",
                alternatingRowStyle: "webgrid-alternating-row",
                headerStyle: "webgrid-header",
                footerStyle: "webgrid-footer",
                selectedRowStyle: "webgrid-selected-row",
            rowStyle: "webgrid-row-style",
        mode: WebGridPagerModes.All,
columns: new[] {
    //grid.Column("ApplicationId"),
    //grid.Column("salutation"),

    //grid.Column("PasswordSalt"),

     grid.Column("FirstName"),

    //grid.Column("LoweredEmail"),
    //grid.Column("PasswordQuestion"),
    //grid.Column("PasswordAnswer"),

    // grid.Column("PasswordFormat"),
    grid.Column("LastName"),
    grid.Column("Password"),
    grid.Column("isactive"),
    //grid.Column("IsLockedOut"),
    grid.Column("email"),
   grid.Column("module_name"), 

    //grid.Column("LastLoginDate"),
    //grid.Column("LastPasswordChangedDate"),
    //grid.Column("LastLockoutDate"),

    //grid.Column("FailedPasswordAttemptCount"),
    //grid.Column("FailedPasswordAttemptWindowStart"),
    //grid.Column("FailedPasswordAnswerAttemptCount"),
    //grid.Column("FailedPasswordAnswerAttemptWindowStart"),
   // Rest of grid columns, seen previously
    @*grid.Column(
       "",
        header: "Actions",
        format: @<text>
    @Html.ActionLink("Edit", "Edit", new { id = item.email }) 
    </text>
    )   , 
     grid.Column(
       "",
        header: "Actions",
        format: @<text>
    @Html.ActionLink("Delete", "Delete", new { id = item.email })
    </text>
    )    *@
@*     grid.Column(
            header:"", 
            format:@<text><div id="btnSelectedRow">
                "@item.GetSelectLink("Edit")</div></text>
            ),*@


     grid.Column(
            header:"", 
            format:@<text><div id="btnSelectedRow">
                "@Html.ActionLink("Edit record", 
                        "EditUser",
                        "UserManager",
                                       new {selectedRow = grid.SelectedRow },
                        null
                        )</div></text>
            )
})
    @if (grid.HasSelection)
    {
        var record = grid.SelectedRow;
@*@RenderPage("~/Views/UserManager/EditUser.cshtml", new { record = grid.SelectedRow })*@

    }
</div>
<script type="text/javascript">
    $(document).ready(function () {
        function jQueryUIStyling() {
            $('input:button, input:submit').button();

            // Style tables.
            $('.webgrid-wrapper').addClass('ui-grid ui-widget ui-widget-content ui-corner-all');
            $('.webgrid-title').addClass('ui-grid-header ui-widget-header ui-corner-top');
            jQueryTableStyling();
        }

        //
        // Style tables using jQuery UI theme. This function is 
        // split out separately so that it can be part of the AJAX
        // callback of the WebGrid WebHelper in ASP.NET MVC.
        //
        function jQueryTableStyling() {
            $('.webgrid').addClass('ui-grid-content ui-widget-content');
            $('.webgrid-header').addClass('ui-state-default');
            $('.webgrid-footer').addClass('ui-grid-footer ui-widget-header ui-corner-bottom ui-helper-clearfix');
        }
    });

</script>

My controller

 public ActionResult EditUser(System.Web.Helpers.WebGrid record)
        {
            record.ToString();

            return View();
        }

Summary

How to pass row data using ActionLink from one view to another via ActionResult method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:56:44+00:00Added an answer on June 13, 2026 at 11:56 pm

    You have two options, really: have your action take the user Id and look the user up, or have each row of your grid contain a form which sends all the user details to the action when you click ‘edit’. Which of those you choose depends on what your action is supposed to do:

    1. If it redirects to a form where the user can edit the user they selected, use the first approach
    2. If it takes all the user details and saves an updated user, use the second approach

    Edit

    To pass the id you can use this for the action link:

    @Html.ActionLink(
        "Edit record",
        "EditUser",
        "UserManager",
        new { id = item.email })
    

    …and this for the action signature:

    public ActionResult EditUser(string id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to explain this as best as I can. I have a Webgrid
I have a view that contains a partial view containing a WebGrid that pages
I'm new to MVC so have some conceptual issues. I have a WebGrid that
I have a MVC3 WebGrid in my View.I want to display a tooltip when
Have deployed numerous report parts which reference the same view however one of them
I Have a little problem with WebGrid control for Asp.Net MVC3. What I want
I have a webgrid and for each rows I have a link that I
I have a webgrid MVC3 contains 4 columns Name, Address, age & Edit. I
I have some short questions about the Webgrid. How can I put in a
I am trying to use a Webgrid and I can get the data to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.