Select ID in table ...

Posted by Kris-I on Stack Overflow See other posts from Stack Overflow or by Kris-I
Published on 2010-06-05T06:43:08Z Indexed on 2010/06/05 6:52 UTC
Read the original article Hit count: 260

Hello,

I have this code

<% foreach (var item in Model.List) { %>    
    <tr>
        <td><%: item.LastName %></td>
        <td><%: item.FirstName %></td>
        <td><%: item.IsEnable %></td>
        <td><a href="#" class="CustomerEdit">Edit</a></td>
        <td><a href="#" class="CustomerDetail">Detail</a></td>
        <td><a href="#" class="CustomerDelete">Delete</a></td>
    </tr>    
<% } %>


<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $(".CustomerEdit").click(function () {
            alert("blabla");
            //need id here
        });
    });
</script>

It's not in the code but I have an "Item.Id", it's not place anywhere because I don't know where place it ;-). I'd like when I click on the "Edit" hyperlink get the id (item.Id) of the current line.

Any idea ?

Thanks,

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about asp.net-mvc