<%@ Page Title="View Fees Details" Language="C#" MasterPageFile="~/Fees.master" AutoEventWireup="true" CodeFile="frmFeesDetailsClass.aspx.cs" Inherits="frmFeesDetailsClass" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<link href="GridviewScroll/gridviewScroll.css" rel="stylesheet" type="text/css" />
<script src="GridviewScroll/gridviewScroll.js" type="text/javascript"></script>
<script src="GridviewScroll/gridviewScroll.min.js" type="text/javascript"></script>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
table
{
border: 1px solid #ccc;
}
table th
{
background-color: #F7F7F7;
color: #333;
font-weight: bold;
}
table th, table td
{
padding: 5px;
border-color: #ccc;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$('#gvCustomers').gridviewScroll({
width: 600,
height: 300,
freezesize: 2, // Freeze Number of Columns.
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "Images/arrowvt.png",
varrowbottomimg: "Images/arrowvb.png",
harrowleftimg: "Images/arrowhl.png",
harrowrightimg: "Images/arrowhr.png"
});
});
</script>
</div>
<div class="content-wrapper">
<div class="content">
<div class="connectedSortable" style="margin-left:10px;">
<div class="col-sm-1">
</div>
<div class="col-sm-12">
<div class="col-md-4"></div><div class="col-md-4"></div>
<div class="col-md-4">
<asp:LinkButton ID="btnExportWord" runat="server" Class="btn btn-success" onclick="btnExportWord_Click" >
<span aria-hidden="true" class="fa fa-file-word-o"></span> MS Word </asp:LinkButton>
<asp:LinkButton ID="btnExportExcel" runat="server" Class="btn btn-info" onclick="btnExportExcel_Click" >
<span aria-hidden="true" class="fa fa-file-excel-o"></span> MS Excel </asp:LinkButton>
<asp:LinkButton ID="btnExportPDF" runat="server" Class="btn btn-danger" onclick="btnExportPDF_Click" >
<span aria-hidden="true" class="fa fa-file-pdf-o"></span> PDF </asp:LinkButton>
</div>
<br/><br/>
<div class="modal-content">
<div class="modal-header" style="background-color:#4682B4;color:#fff">
<!-- <h4 class="modal-title" style="text-align:center; text-decoration:underline;">Student Contact Information</h4> -->
<strong><span class="fa fa-phone"></span> Student Fees Details</strong>
</div>
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<label class="control-label" style="margin-top: 10px;">Year</label>
<asp:DropDownList ID="ddlYear" runat="server" AutoPostBack="True"
class="form-control" onselectedindexchanged="ddlYear_SelectedIndexChanged"></asp:DropDownList>
</div>
<div class="col-sm-3">
<label class="control-label" style="margin-top: 10px;">Class</label>
<asp:DropDownList ID="ddlClass" runat="server" AutoPostBack="True"
class="form-control" onselectedindexchanged="ddlClass_SelectedIndexChanged" ></asp:DropDownList>
</div>
<div class="col-sm-3">
<label class="control-label" style="margin-top: 10px;">Section</label>
<asp:DropDownList ID="ddlSection" runat="server" AutoPostBack="True"
class="form-control" onselectedindexchanged="ddlSection_SelectedIndexChanged" ></asp:DropDownList>
</div>
<div class="col-sm-3"> <br/><br/>
<label class="control-label" style="margin-top: 10px; color:Green;">Total Students:</label>
<span class="badge"><asp:Label ID="lblTotal" runat="server"></asp:Label></span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 ">
<div class="table-responsive">
<asp:GridView ID="gvCustomers" runat="server" AllowPaging="false" ShowFooter = "false"
Class="table table-striped table-bordered table-hover" AutoGenerateColumns="True" Style="width: 40%; border-collapse: collapse;"
>
</asp:GridView>
</div></div></div>
</div></div>
</div>
</div>
</div>
</div>
</asp:Content>
protected void ddlSection_SelectedIndexChanged(object sender, EventArgs e)
{
this.BindGrid();
}
protected void BindGrid()
{
con = new SqlDbConnect();
con.SqlQuery(@"DECLARE @DynamicPivotQuery AS NVARCHAR(MAX)
DECLARE @ColumnName AS NVARCHAR(MAX)
SELECT @ColumnName = ISNULL(@ColumnName + ',','')+ QUOTENAME(FeesDetail) FROM (SELECT DISTINCT FeesDetail FROM tblFeesDetail where YearID=@YId and ClassID=@CId and SectionID=@SId) AS FeesHead
SET @DynamicPivotQuery = ';WITH CTE AS(SELECT AdmissionNo,ReferenceNo,SName,FName,ParentID,FeesDetail,Amount FROM tblFeesDetail as fd inner join tblStdReg as sr on sr.ClassID=fd.ClassID and Active_Status=''Active'' inner join tblDefClass as dc on fd.ClassID=dc.ClassID where fd.YearID=('+@YId+') and fd.ClassID=('+@CId+') and fd.SectionID=('+@SId+'))
SELECT AdmissionNo,ReferenceNo,SName,FName,ParentID,'+@ColumnName+'FROM CTE
PIVOT (MAX(Amount)
FOR FeesDetail IN('+@ColumnName+')) p
'
EXEC(@DynamicPivotQuery);");
con.Cmd.Parameters.Add(new SqlParameter("@YId",ddlYear.SelectedValue.ToString()));
con.Cmd.Parameters.Add(new SqlParameter("@CId", ddlClass.SelectedValue.ToString()));
con.Cmd.Parameters.Add(new SqlParameter("@SId", ddlSection.SelectedValue.ToString()));
adapt.SelectCommand = con.Cmd;
adapt.Fill(sTable);
if (sTable.Rows.Count > 0)
{
gvCustomers.Visible = true;
gvCustomers.DataSource = sTable;
gvCustomers.DataBind();
lblTotal.Text = gvCustomers.Rows.Count.ToString();
}
It is not freezing the colomn in gridview pls solution with snapshoot