Error in displaying reords in view

Posted by Klbaiju under ASP.NET MVC on 9/10/2014 | Points: 10 | Views : 528 | Status : [Member] | Replies : 3
Hi,

following is a working code that displays record in view using datacolumn and datarow

<table>
<thead>
<tr>
@foreach (DataColumn col in Model.Columns)
{
<th>@col.ColumnName</th>
}
</tr>
</thead>
<tbody>
@foreach (DataRow row in Model.Rows)
{
<tr>
@foreach (DataColumn col in Model.Columns)
{
<td>@row[col.ColumnName]</td>

}
<td> @Html.ActionLink("Edit", "Edit") |</td>
</tr>
}
</tbody>
</table>


my problem is i can't add an in edit field.in this example first column of every row contains id .

i want to add id to edit field like this

<td> @Html.ActionLink("Edit", "Edit"), new { id=col[0] } |</td>


i tried it several times ,yet to succeed.

Regards

Baiju




Responses

Posted by: Bandi on: 9/11/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
try this
http://stackoverflow.com/questions/485393/how-to-bind-data-as-parameter-to-actionlink

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 9/11/2014 [Member] [MVP] Platinum | Points: 25
Posted by: Naveenhcl on: 9/11/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

Refer below link for your reference to clear the issue.

http://www.cafe-encounter.net/p1474/asp-net-mvc-html-actionlink-with-parameters-doesnt-work-in-a-weird-way

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response