Hi akhter,
Check this example. Now please take its reference and correct your code.
HTML
<asp:Button Text="Save" runat="server" /><br /><br />
<asp:HiddenField ID="hfShowHide" runat="server" Value="false" />
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#menuOne">
<span class="glyphicon glyphicon-plus"></span>
Cheque
</a>
</h4>
</div>
<div id="menuOne" class="panel-collapse collapse">
<div class="panel-body">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CssClass="table">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function () {
if ($('#hfShowHide').attr('value') == 'true') {
$('#menuOne').removeClass();
$('#menuOne').addClass('panel-collapse collapse in');
$(this).find('span').removeClass('glyphicon-plus');
$(this).find('span').addClass('glyphicon-minus');
} else {
$('#menuOne').removeClass();
$('#menuOne').addClass('panel-collapse collapse');
$(this).find('span').removeClass('glyphicon-minus');
$(this).find('span').addClass('glyphicon-plus');
}
$(".accordion-toggle").click(function () {
if ($('#menuOne').hasClass('collapse in')) {
$('#hfShowHide').attr('value', 'false');
$(this).find('span').removeClass('glyphicon-minus');
$(this).find('span').addClass('glyphicon-plus');
} else {
$('#hfShowHide').attr('value', 'true');
$(this).find('span').removeClass('glyphicon-plus');
$(this).find('span').addClass('glyphicon-minus');
}
});
});
</script>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.AddRange(new System.Data.DataColumn[]
{
new System.Data.DataColumn("Name"),
new System.Data.DataColumn("Country")
});
dt.Rows.Add("John Hammond", "United States");
dt.Rows.Add("Mudassar Khan", "India");
dt.Rows.Add("Suzanne Mathews", "France");
dt.Rows.Add("Robert Schidner", "Russia");
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
Screenshot