I have a gridview
which I want it's rows to expand and display the passed BatchID.
At the moment I'm using href="javascript:switchViews('div<%# Eval("BatchID")%>', 'one');"
to pass the information but I can't get the BatchID on the Javascript end.
At the javascript end I should get this information to assign my new rows with an ID so when I toggle them, they don't all get removed, but only the corresponding ones. At the moment, all created tr
's get to be removed from every row
if toggled and also the text "Hide Details
" remains on other rows which are not clicked but their nested tr's get removed.
I have tried to get the BatchID from the params but I don't know how. Any ideas for the above two problems?
<script type="text/javascript">
$(document).ready(function (params) {
$('.showDetails').click(function () {
// Show Details DIV
$(this).closest('tr').find('.details').toggle('fast');
// Return false to disable default postback on click of a <a> element
return false;
}).toggle(
function () {
// Trigger text/html to toggle to when hiding.
$(this).html('Hide Details').stop();
$(this).closest("tr").after("<tr class='" + event.id + "'><td></td><td colspan = '999'><div>" + '111' + "</div></td></tr>");
// $(this).closest('tr').find('.details').append('<div class=' + 'shit' + '>3399</div>');
},
function () {
// Trigger text/html to toggle to when showing.
$(this).html('Show Details').stop();
//$(this).find('.zoom').remove();
$('tr.' + event.id).remove();
}
);
});
</script>
Gridview:
<asp:TemplateField>
<ItemTemplate>
<a class="showDetails" href="javascript:switchViews('div<%# Eval("BatchID")%>', 'one');">Show Details</a>
</ItemTemplate>
</asp:TemplateField>