Dear Sir
Gridview scroll is not working in update panel in asp.net
please help me
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/DefineCss1.css" rel="stylesheet" />
<link href="../Style/GridViewStyleNew.css" rel="stylesheet" />
<script src="../Scripts/jquery-1.7.2.min.js"></script>
<link type="text/css" href="../Scripts/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../Scripts/jquery-ui-1.8.19.custom.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<%--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>--%>
<%-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>--%>
<%-- Start GridView Scroll --%>
<script src="../GridViewScrollBothSide/jquery-1.9.1.min.js"></script>
<script src="../GridViewScrollBothSide/JavaScript.js"></script>
<script src="../GridViewScrollBothSide/GridViewScrollBothSide.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.MyDataGridViewListOne').gridviewScroll({
width: 1090,
freezesize: 4, // Freeze Number of Columns.
height: 250,
headerrowcount: 1, //Freeze Number of Rows with Header.
arrowsize: 30,
varrowtopimg: "../GridViewScrollBothSide/ImageScroll/arrowvt.png",
varrowbottomimg: "../GridViewScrollBothSide/ImageScroll/arrowvb.png",
harrowleftimg: "../GridViewScrollBothSide/ImageScroll/arrowhl.png",
harrowrightimg: "../GridViewScrollBothSide/ImageScroll/arrowhr.png"
});
});
</script>
<%-- Start Style --%>
<style type="text/css">
table { border: 1px solid #ccc; border-collapse: collapse; }
table th { background-color: #ccc; color: #333; font-weight: bold; }
table th, table td { padding: 5px; border: 1px solid #ccc; }
.MyDataGridViewListOne { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListOne td { padding: 5px; }
.MyDataGridViewListOne th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #fb8b03; }
.MyDataGridViewListTwo { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListTwo td { padding: 5px; }
.MyDataGridViewListTwo th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #f4f909; }
.MyDataGridViewListThree { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListThree td { padding: 5px; }
.MyDataGridViewListThree th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #fbc406; }
.MyDataGridViewListFour { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListFour td { padding: 5px; }
.MyDataGridViewListFour th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #94fcc9; }
.MyDataGridViewListFive { align-items: baseline; margin-left: auto; margin-right: auto; }
.MyDataGridViewListFive td { padding: 5px; }
.MyDataGridViewListFive th { padding: 5px; font-family: Arial; font-size: 12px; background-color: #94fcc9; }
.ComboBoxStyle .ajax__combobox_itemlist li { background-color: DarkGreen; border: 1px solid YellowGreen; color: White; font-size: medium; font-family: Arial; font-size: 12px; padding-bottom: 5px; }
.bg_Entry_Color1 { background-color: #f0f5f5; }
.bg_Entry_Color2 { background-color: #e9e4f0; }
.bg_Entry_Color3 { background-color: #e3f5ec; }
.bg_Entry_Color4 { background-color: #E6E6FA; }
.bg_Entry_Color5 { background-color: #fbf8da; }
.bg_Entry_Color6 { background-color: #FFF0F5; }
.bg_Entry_Color7 { background-color: #F5F5F5; }
.bg_Entry_ColorUserDetail { background-color: #a8a7a7; }
.mydropdownlistnew { color: #fff; font-size: 20px; padding: 5px 10px; border-radius: 5px; background-color: #cc2a41; font-weight: bold; }
.mydropdownlistnew1 { color: #fff; font-size: 20px; padding: 5px 10px; border-radius: 5px 12px; background-color: #292929; font-weight: bold; }
</style>
<%-- End Style --%>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%-- Start Heading --%>
<div class="container mb-0 mt-0">
<div class="row g-0 " style="background-image: linear-gradient(to right, lightblue ,lightgreen);">
<div class="col col-12 fs-3 text-center">
<asp:Label ID="Label1" runat="server" Text="Generate Order Form -Sales"></asp:Label>
</div>
</div>
</div>
<%-- End Heading --%>
<%-- Start Search Supplier --%>
<div class="container mb-0">
<div class="row g-0 " style="background-image: linear-gradient(to right, #e6d2fa ,#e6d2fa);">
<div class="col-2 ">
<asp:RadioButton ID="RbtnCustomer" Text="Customer" GroupName="SearchValue" CssClass="Rbtn-Hover-user" runat="server" />
</div>
<div class="col-2 ">
<asp:RadioButton ID="RbtnProforma" Text="Proforma" GroupName="SearchValue" CssClass="Rbtn-Hover-user" runat="server" />
</div>
<div class="col-8 d-flex justify-content-center">
<asp:TextBox ID="TxtSearchValue" placeholder="Search Value" CssClass="form-control text-uppercase w-100 " runat="server" AutoCompleteType="Disabled"></asp:TextBox>
<div class="h-10 align-items-center justify-content-center">
<div style="background: lightgray">
<img id="loader1" style="display: none;" src="https://www.aspsnippets.com/demos/loader.gif" alt="" />
</div>
</div>
<asp:Button ID="BtnSearchProforma" CssClass="btn btn-primary Button-Height-user btn-outline-dark"
OnClientClick="showLoader1();" runat="server" Text="Search Value" OnClick="BtnSearchProforma_Click" />
</div>
</div>
</div>
<%-- End search value --%>
<%-- Start Supplier Invoice List --%>
<div class=" container mb-0 mt-0 ">
<asp:Panel ID="PnlPiList" runat="server">
<div class="row g-0 text-center bg-primary">
<asp:Label ID="Label8" CssClass=" text-white fs-5 " runat="server" Text="Proforma List"></asp:Label>
</div>
<div class="row g-0">
<div class="col col-12 justify-content-center">
<asp:GridView ID="GvPiList" runat="server"
GridLines="Both"
EmptyDataText="No Record Found"
EmptyDataRowStyle-ForeColor="Red"
EmptyDataRowStyle-Font-Bold="true"
EmptyDataRowStyle-BorderStyle="None"
CssClass="MyDataGridViewListOne"
OnRowCommand="GvPiList_RowCommand"
HorizontalAlign="Center"
AllowSorting="true" OnSorting="OnSorting"
RowStyle-CssClass="rows"
AutoGenerateColumns="false">
<EmptyDataRowStyle BorderStyle="None" Font-Bold="True" ForeColor="Red"></EmptyDataRowStyle>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="Blue" Font-Names="Arial" Font-Size="12px" Font-Bold="True" ForeColor="Blue" />
<RowStyle CssClass="rows"></RowStyle>
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Select">
<ItemTemplate>
<asp:Button ID="btnSelectPI" CssClass="btn btn-primary Button-Height-user" runat="server"
Text="Select"
CommandArgument="<%#((GridViewRow)Container).RowIndex%>"
CommandName="PIDetail" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PiDate"
HeaderText="Date"
NullDisplayText="Null"
ReadOnly="True"
DataFormatString="{0:dd-MMM-yyyy}"
SortExpression="PiDate"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="PiDetail"
HeaderText="Proforma No"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="PiDetail"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="OrderStatus"
HeaderText="Order Confirm"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="OrderStatus"
ItemStyle-Wrap="true">
<ItemStyle Wrap="true" />
</asp:BoundField>
<asp:BoundField DataField="OrderDetail"
HeaderText="Order No"
NullDisplayText="Null"
ReadOnly="True"
ItemStyle-Wrap="true">
<ItemStyle Wrap="true" />
</asp:BoundField>
<asp:BoundField DataField="CustomerName"
HeaderText="Customer"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="CustomerName"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="BrandName"
HeaderText="Brand Name"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="BrandName"
ItemStyle-Wrap="false">
<ItemStyle Wrap="false" />
</asp:BoundField>
<asp:BoundField DataField="ModelName"
HeaderText="Model Name"
NullDisplayText="Null"
ReadOnly="True"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="Transmission"
HeaderText="Transmission"
NullDisplayText="Null"
ReadOnly="True"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="BrandCode"
HeaderText="Brand Code"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="BrandCode"
ItemStyle-Wrap="false">
<ItemStyle Wrap="false" />
</asp:BoundField>
<asp:BoundField DataField="ModelCode"
HeaderText="Model Code"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="ModelCode"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="StaffName"
HeaderText="PI Issueed By"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="StaffName"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="StaffName"
HeaderText="PI Issueed By"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="StaffName"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="StaffName"
HeaderText="PI Issueed By"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="StaffName"
ItemStyle-Wrap="false"></asp:BoundField>
<asp:BoundField DataField="StaffName"
HeaderText="PI Issueed By"
NullDisplayText="Null"
ReadOnly="True"
SortExpression="StaffName"
ItemStyle-Wrap="false"></asp:BoundField>
</Columns>
</asp:GridView>
<br />
</div>
</div>
</asp:Panel>
</div>
<%-- End Supplier Invoice List --%>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
public partial class AtestGridViewScrollWithUpdatepanel : System.Web.UI.Page
{
SqlConnection SqlCn;
SqlCommand SqlCm;
SqlDataReader SqlDr;
SqlDataAdapter SqlDa;
DataTable SqlDt;
SqlTransaction SqlTrans;
ConnectionState ConState;
static string SqlQry;
static string ConPath;
// End Sql connection
protected void Page_Load(object sender, EventArgs e)
{
}
protected void OnSorting(object sender, GridViewSortEventArgs e)
{
}
protected void BtnSearchProforma_Click(object sender, EventArgs e)
{
this.LoadProfomaExisting();
}
// End Search Proforma
protected void LoadProfomaExisting()
{
GvPiList.Visible = true;
ConnectionStringFunction();
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
try
{
SqlCm = new SqlCommand("ProformaList", SqlCn);
SqlCm.CommandType = CommandType.StoredProcedure;
if (RbtnCustomer.Checked == true)
{
SqlCm.Parameters.AddWithValue("SearchBy", "CUSTOMER");
//SqlCm.Parameters.AddWithValue("MainBranchCode", MainClass.MainBranchCodeClass);
}
else if (RbtnProforma.Checked == true) // Start Own PI Selection
{
SqlCm.Parameters.AddWithValue("SearchBy", "PI");
}
SqlCm.Parameters.AddWithValue("SearchValue", TxtSearchValue.Text.Trim().ToUpper());
SqlCm.Parameters.AddWithValue("MainBranchCode", 2010);
SqlCm.Parameters.AddWithValue("StaffId", 101);
SqlDa = new SqlDataAdapter();
SqlDa.SelectCommand = SqlCm;
SqlDt = new DataTable();
SqlDa.Fill(SqlDt);
GvPiList.DataSource = SqlDt;
GvPiList.DataBind();
}
// End Try
catch (Exception ex)
{
//SwalTitle = "Error !!";
//SwalShowMessage = ex.Message.ToString();
////SwalShowMessage = "Select Search Option !!";
//SwalMessageType = "error"; // info error warning
//SwalErrorMessageDisplayNo();
//return;
}
// Catch
finally
{
SqlCn.Close();
}
// End Finally
}
// End Load Existing PI
protected void GvPiList_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
// Rowcommnad
// Start connection string
protected void ConnectionStringFunction()
{
// Start Connection String From Class
MainClass ClassObj = new MainClass(); // Class Object
//<Class> <ObjectName>= new <ClassFileName>;
MainClass.ConPathClass = ClassObj.GetConnectionForClass(); //Connection path from Class
//Define Function Return Value
//<ClassName>.<Variable>=<ClassObject>.<FunctionName()>;
MainClass.ConPathClass = MainClass.ConPathClass.ToString();
ConPath = MainClass.ConPathClass.ToString();
//End Connection String From Class
try
{
SqlCn = new SqlConnection(ConPath);
SqlCn.Open();
ConState = SqlCn.State;
SqlCn.Close();
}
// End Try
catch (Exception ex)
{
}
finally
{
SqlCn.Close();
}
}
//End Connection String From Class
}