Link to home
Start Free TrialLog in
Avatar of Steve7423
Steve7423Flag for Canada

asked on

MVC Capture the selected item id clicked by the user

First time working with MVC.  I've made good progress but I need to know how to handle the issue of capturing a specific row item the user clicked.  The attached EESelected Item_Problem Pic shows the screen.  Obviously there are more items on the screen but for simplicity I showed just one to get the point across.  When the user clicks the 'Execute' it fires the action 'Execute', as seen in the attached Code_Debug_Pic.  I need this action to contain iether the specific item and id the user clicked.  from here I need to look up corosponding records related to the item id.  the issue is how do I capture the item info from the screen when the user clicks it?

If you need more info let me know.
EE-Selected-Item-Problem.bmp
Code-Debug-Pic.bmp
SOLUTION
Avatar of Roopesh Reddy
Roopesh Reddy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve7423

ASKER

Great link, thanks.  I've got a few things done, but being green with html and views, I now need to pass the selected item to the action link.  here's the code.

 WebGrid grid = new WebGrid(Model.Where(d => d.Disc_Name == discName),selectionFieldName: "selectedRow");
       
                                   
        <pre>@grid.GetHtml(

        fillEmptyRows: false,

        alternatingRowStyle: "alternative-row",

        headerStyle: "grid-header",

        footerStyle: "foot-grid",

        mode: WebGridPagerModes.All,

        firstText: "<< First",

        previousText: "< Previous", nextText: "Next >",

        lastText: "Last >>",



        columns: new[] {  

        grid.Column("Disc_Name",header:"",canSort:false),
        grid.Column("Software", canSort:false),
        grid.Column(  

           "",  

            header: "Action",  

            format: @<text>  

                    @Html.ActionLink("Execute",   "Execute")  
                     @Html.ActionLink("Execute",   "Execute", grid.selectedrow)  


                    </text>  

                    )
                     
         })
         
         

You'll notice I've added the grid.selectedrow to the ActionLink above.  I have no idea if this is correct or how it should be done.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

So, mark your comment as Answer then!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

In that case, you can assign some points to me with a NOTE to Administrator!!!
The steps outlined in my comment show exactly what the problem was so others can combine roopeshreddy's link and my comment, in order to see the connection.