hello,
The problem is on click of collapse panel it pass the hidden value to query string but it does not open collapse panel.
please note my collapse panel is inside listview there fore href of collapse is dynamic pass.
i want to collapse panel open at the same time hidden field value pass to query string.
i have this bootstrap collapse
<a role="button" id="lnk" data-toggle="collapse" href="#collapseExample<%#Container.DataItemIndex%>" aria-expanded="false" aria-controls="collapseExample" >
<div class="collapse margin radius border grey-bg" id="collapseExample<%#Container.DataItemIndex%>">
<asp:HiddenField ID="HiddenField2" runat="server" Value='<%# Eval("ID") %>' />
</div>
then i have this script to pass the hiddenfield value to query string
<script type="text/javascript">
$(function () {
$('[id*=lnk]').on('click', function () {
var id = $(this).closest('div[class="whitebg border radius margin"]').find('[id*=HiddenField2]').val();
var oldURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var newUrl = oldURL + "?Id=" + id;
if (window.history != 'undefined' && window.history.pushState != 'undefined') {
window.history.pushState({ path: newUrl }, '', newUrl);
//$('#collapseExample').collapse('in');
$("#<%=HiddenField1.ClientID %>").val(id);
}
return false;
});
});
</script>
please advice