I have a c# Grdiview, which contains an Hyperlink in the first col. when the user clicks the link, I need the following to happen.
1) Obtain the DataKey Name of the row selected and pass this to a method (code behind), which will build the neccessary data to show in the Model.
2) Present the Model with the data built.
So, I have the Model working, in the sense that I can present a empty one, but I know need assistance with the rest.
I have the following function which doesn't display the value I need
$(function () {
$('.view-details').click(function (e) {
e.preventDefault();
$('#myModal').modal();
$('#ticket-id').text("Ticket id: " + $(this).children('td').eq(0).text());
});
$('#ticket-tabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
$('#ticket-tabs a:first').tab('show');
});
EDIT <Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Hyperlink href="#" data-id="1" class="view-details" runat="server">View details</asp:Hyperlink></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Message Id">
.
.
</Columns>
Once I have the Id, I can then progress trying to populate the data to display