开发者

value not getting from index view to controller method in asp.net mvc 2

As i showing the list of records in the index view in my asp.net mvc 2 + C# application. on the edit link, I am passing 开发者_StackOverflow社区the string value which is the primary key in the db. so that I can access the respective records. but as i set the debugger at the controller in the Edit method , in parameter list I am not getting the value that I have passed. Scenario is like this :

INDEX : View

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

In CONTROLLER:

public ActionResult Edit(String CRNo) // Here getting null
    {...some code...}

Where CRNo is string property of item.


You are passing id as a parameter in the link, so you should read that.

public ActionResult Edit(string id)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜