asp.net mvc - ASP MVC3 - ActionLink not routing to controller properly -


below action link i'm using in asp mvc3 view. need method in controller , send in 2 variables. these variables serve compound key on sql table controller method trying pull information from.

the link appears rendered @html.actionlink, getting error:

description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly.

requested url: /banklistmastercontroller/agentedit/11

here action link

@html.actionlink("edit agent", "agentedit", "banklistmastercontroller",                                             new { agentid = int.parse(item.agentid), id = item.id }, null) 

here controller method

    public viewresult agentedit(int id, int agentid)     {         string compare = agentid.tostring();          banklistagentid agent = (from c in db.banklistagentid                                  c.id == id &&                                        c.agentid.equals(compare)                                  select c).single();          return view("agentedit", agent);     } 

and here url rendered in original view

http://localhost:2574/banklistmastercontroller/agentedit/11?agentid=5309721 

i've put breakpoint in first line of method , never gets tripped when debugging.

you not need include "controller" in third parameter.

try:

@html.actionlink("edit agent", "agentedit", "banklistmaster", new { agentid = int.parse(item.agentid), id = item.id }, null) 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -