locked
Fix Gridview Header Print Problem RRS feed

  • Question

  • User-807418713 posted

    Hello

    This Is My aspx page It has fix gridview header 

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="AABB.aspx.cs" Inherits="NN_JC" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Customer Route Card</title>
          <link href="stylesheet.css" rel="stylesheet" type="text/css" />
     
         <script type="text/javascript" src="jquery-3.2.1.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var width = new Array();
                var table = $("table[id*=GridView1]"); //Pass your gridview id here.
                table.find("th").each(function (i) {
                    width[i] = $(this).width();
                });
                headerRow = table.find("tr:first");
                headerRow.find("th").each(function (i) {
                    $(this).width(width[i]);
                });
                firstRow = table.find("tr:first").closest();
                firstRow.find("").each(function (i) {
                    $(this).width(width[0]);
                });
                var header = table.clone();
                header.empty();
                header.append(headerRow);
                header.append(firstRow);
                header.css("width", width);
                $("#container").before(header);
                table.find("tr:first td").each(function (i) {
                    $(this).width(width[i]);
                });
                $("#container").height(400);
                $("#container").width(table.width());
                $("#container").append(table);
            });
        </script>
        
    </head>
    <body style="font-size: 12pt; font-family: Times New Roman">
        <form id="form1" runat="server">
        <div>
        
      <div id="container" style=" overflow: scroll; overflow-x: hidden">
        </div>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#404040"
                            BorderStyle="Solid" EnableModelValidation="True"
                            Font-Bold="True" Font-Names="Palatino Linotype"  Font-Size="11pt" Width="620px" Height="80px" ShowFooter="True">
                    <Columns>
                        <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item">
                            <ItemStyle HorizontalAlign="Left" Width="140px" />
                            <HeaderStyle HorizontalAlign="Center" Width="140px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="140px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Date">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Side">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Taken" HeaderText="Taken" SortExpression="Calfs">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                       
                        
                         <asp:TemplateField HeaderText="Out Time">
                                    <ItemTemplate>
                                        <asp:Label ID="Text1" runat="server" Text='<%# Bind("Out_Time") %>'></asp:Label>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:Label ID="FText12" runat="server" ForeColor="Blue" Text="Total"></asp:Label>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Taken Quantity">
                                    <ItemTemplate>
                                        <asp:TextBox ID="Text1"  Font-Size="Large" Width="100px" ForeColor="Red" runat="server"></asp:TextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:TextBox ID="FText1" Width="100px" runat="server"></asp:TextBox>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                
           
            <br />
          
           
        </div>
        </form>
    </body>
    </html>
    

    This is my code behind code

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.SqlClient;
    using System.IO;
    
    public partial class NN_JC : System.Web.UI.Page
    {
          
        decimal TPcs = 0;
    
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {  
    
        } 
    
        protected void Page_Init(object sender, EventArgs e)
        {
            
        }
    
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
              
                DataTable kzdt = new DataTable();
                kzdt.Columns.AddRange(new DataColumn[6] { new DataColumn("Item"), new DataColumn("Rate"), new DataColumn("Qty"), new DataColumn("Taken"), new DataColumn("Out_Time"), new DataColumn("Sign") });
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
    
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                kzdt.Rows.Add("AB", "1", "23", "Yes", "Hello", "");
                kzdt.Rows.Add("CD", "4", "24", "No", "Ok", "");
                kzdt.Rows.Add("EF", "5", "25", "Yes", "Working", "");
                kzdt.Rows.Add("GH", "8", "26", "No", "Dummy", "");
                
                GridView1.DataSource = kzdt;
                GridView1.DataBind();
    
                //
            }
        }
        
        
        
        protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            foreach (TableCell cell in e.Row.Cells)
            {
                cell.BorderColor = System.Drawing.Color.Black;
                cell.BorderWidth = new Unit(2);
                cell.BorderStyle = BorderStyle.Solid;
            }
        }
    }
    

    I want two things from this 

    1) I want to print this girdivew in a4 page on button click without postback

    2) I Want to add Heading "Todays Report Dated 21-Aug-2019"

    Thanks

    Thursday, August 22, 2019 3:07 AM

Answers

  • User-719153870 posted

    Hi Gopi.MCA,

    I'm sorry for that misunderstanding, but are you trying to let your customer input date on their own into two textboxes for only one date value?

    Please update your code like below:

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Customer Route Card</title>
          <%--<link href="stylesheet.css" rel="stylesheet" type="text/css" />--%>
        <script src="Scripts/jquery-3.3.1.min.js"></script>
        <style>
            @media print {
                table {
                    page-break-inside: avoid;
                }
            }
        </style>
        <script type="text/javascript">
            $(document).ready(function () {
                var width = new Array();
                var table = $("table[id*=GridView1]"); //Pass your gridview id here.
                
                table.find("th").each(function (i) {
                    width[i] = $(this).width();
                });
                headerRow = table.find("tr:first");
                headerRow.find("th").each(function (i) {
                    $(this).width(width[i]);
                });
                firstRow = table.find("tr:first").closest();
                firstRow.find("").each(function (i) {
                    $(this).width(width[0]);
                });
                var header = table.clone();
                header.empty();
                header.append(headerRow);
                header.append(firstRow);
                header.attr('id','GV1');
                header.css("width", width);
                //header.css("display", "table-header-group");
                $("#container").before(header);
                table.find("tr:first td").each(function (i) {
                    $(this).width(width[i]);
                });
                $("#container").height(400);
                $("#container").width(table.width());
                $("#container").append(table);
            });
            function PrintElem() {
                var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    
                mywindow.document.write('<html><head>');
                mywindow.document.write('</head><body >');
                mywindow.document.write('<h1>Todays Report Dated ' + document.getElementById("txtDate").value + '</h1>');
                mywindow.document.write(document.getElementById("GV1").outerHTML);
                mywindow.document.write(document.getElementById("GridView1").outerHTML);
                mywindow.document.write('</body></html>');
    
                mywindow.document.close(); // necessary for IE >= 10
                mywindow.focus(); // necessary for IE >= 10*/
    
                mywindow.print();
                mywindow.close();
    
                return true;
            }
        </script>
        
    </head>
    <body style="font-size: 12pt; font-family: Times New Roman">
        <form id="form1" runat="server">
        <div>
        
      <div id="container" style=" overflow: scroll; overflow-x: hidden">
        </div>
            <input type="text" id="txtDate" />
            <input id="Print" type="button" value="print" onclick="PrintElem()" />
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#404040"
                            BorderStyle="Solid" EnableModelValidation="True"
                            Font-Bold="True" Font-Names="Palatino Linotype"  Font-Size="11pt" Width="620px" Height="80px" ShowFooter="True">
                    <Columns>
                        <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item">
                            <ItemStyle HorizontalAlign="Left" Width="140px" />
                            <HeaderStyle HorizontalAlign="Center" Width="140px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="140px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Date">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Side">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Taken" HeaderText="Taken" SortExpression="Calfs">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                       
                        
                         <asp:TemplateField HeaderText="Out Time">
                                    <ItemTemplate>
                                        <asp:Label ID="Text1" runat="server" Text='<%# Bind("Out_Time") %>'></asp:Label>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:Label ID="FText12" runat="server" ForeColor="Blue" Text="Total"></asp:Label>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Taken Quantity">
                                    <ItemTemplate>
                                        <asp:TextBox ID="Text1"  Font-Size="Large" Width="100px" ForeColor="Red" runat="server"></asp:TextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:TextBox ID="FText1" Width="100px" runat="server"></asp:TextBox>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            <br />
        </div>
        </form>
    </body>
    </html>

    This should make the date value dynamic and the unperfect of the print, like below:

    Best Regard,

    Yang Shen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 23, 2019 3:21 AM

All replies

  • User-719153870 posted

    Hi Gopi.MCA,

    1) I want to print this girdivew in a4 page on button click without postback

    2) I Want to add Heading "Todays Report Dated 21-Aug-2019"

    You can do the print wiht JS which is without postback.

    Please refer to this thread where you can find how to edit the content which you want to print.

    Also, you can refer to below demo built based on your code and the code from above thread:

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Customer Route Card</title>
          <%--<link href="stylesheet.css" rel="stylesheet" type="text/css" />--%>
        <script src="Scripts/jquery-3.3.1.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var width = new Array();
                var table = $("table[id*=GridView1]"); //Pass your gridview id here.
                table.find("th").each(function (i) {
                    width[i] = $(this).width();
                });
                headerRow = table.find("tr:first");
                headerRow.find("th").each(function (i) {
                    $(this).width(width[i]);
                });
                firstRow = table.find("tr:first").closest();
                firstRow.find("").each(function (i) {
                    $(this).width(width[0]);
                });
                var header = table.clone();
                header.empty();
                header.append(headerRow);
                header.append(firstRow);
                header.css("width", width);
                $("#container").before(header);
                table.find("tr:first td").each(function (i) {
                    $(this).width(width[i]);
                });
                $("#container").height(400);
                $("#container").width(table.width());
                $("#container").append(table);
            });
            function PrintElem() {
                var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    
                mywindow.document.write('<html><head>');
                mywindow.document.write('</head><body >');
                mywindow.document.write('<h1>Todays Report Dated 21-Aug-2019</h1>');
                mywindow.document.write(document.getElementById("GridView1").outerHTML);
                mywindow.document.write(document.getElementById("container").innerHTML);
                mywindow.document.write('</body></html>');
    
                mywindow.document.close(); // necessary for IE >= 10
                mywindow.focus(); // necessary for IE >= 10*/
    
                mywindow.print();
                mywindow.close();
    
                return true;
            }
        </script>
        
    </head>
    <body style="font-size: 12pt; font-family: Times New Roman">
        <form id="form1" runat="server">
        <div>
        
      <div id="container" style=" overflow: scroll; overflow-x: hidden">
        </div>
            <input id="Print" type="button" value="print" onclick="PrintElem()" />
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#404040"
                            BorderStyle="Solid" EnableModelValidation="True"
                            Font-Bold="True" Font-Names="Palatino Linotype"  Font-Size="11pt" Width="620px" Height="80px" ShowFooter="True">
                    <Columns>
                        <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item">
                            <ItemStyle HorizontalAlign="Left" Width="140px" />
                            <HeaderStyle HorizontalAlign="Center" Width="140px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="140px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Date">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Side">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Taken" HeaderText="Taken" SortExpression="Calfs">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                       
                        
                         <asp:TemplateField HeaderText="Out Time">
                                    <ItemTemplate>
                                        <asp:Label ID="Text1" runat="server" Text='<%# Bind("Out_Time") %>'></asp:Label>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:Label ID="FText12" runat="server" ForeColor="Blue" Text="Total"></asp:Label>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Taken Quantity">
                                    <ItemTemplate>
                                        <asp:TextBox ID="Text1"  Font-Size="Large" Width="100px" ForeColor="Red" runat="server"></asp:TextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:TextBox ID="FText1" Width="100px" runat="server"></asp:TextBox>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            <br />
        </div>
        </form>
    </body>
    </html>

    Best Regard,

    Yang Shen

    Thursday, August 22, 2019 6:28 AM
  • User-807418713 posted

    Hello

    This Date Will Be My Textbox1 and Textbox2 Date

     mywindow.document.write('<h1>Todays Report Dated 21-Aug-2019</h1>');

    Second On Print It not coming perfect please see the screenshot below

    Thank You

    Thursday, August 22, 2019 9:40 AM
  • User-719153870 posted

    Hi Gopi.MCA,

    I'm sorry for that misunderstanding, but are you trying to let your customer input date on their own into two textboxes for only one date value?

    Please update your code like below:

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Customer Route Card</title>
          <%--<link href="stylesheet.css" rel="stylesheet" type="text/css" />--%>
        <script src="Scripts/jquery-3.3.1.min.js"></script>
        <style>
            @media print {
                table {
                    page-break-inside: avoid;
                }
            }
        </style>
        <script type="text/javascript">
            $(document).ready(function () {
                var width = new Array();
                var table = $("table[id*=GridView1]"); //Pass your gridview id here.
                
                table.find("th").each(function (i) {
                    width[i] = $(this).width();
                });
                headerRow = table.find("tr:first");
                headerRow.find("th").each(function (i) {
                    $(this).width(width[i]);
                });
                firstRow = table.find("tr:first").closest();
                firstRow.find("").each(function (i) {
                    $(this).width(width[0]);
                });
                var header = table.clone();
                header.empty();
                header.append(headerRow);
                header.append(firstRow);
                header.attr('id','GV1');
                header.css("width", width);
                //header.css("display", "table-header-group");
                $("#container").before(header);
                table.find("tr:first td").each(function (i) {
                    $(this).width(width[i]);
                });
                $("#container").height(400);
                $("#container").width(table.width());
                $("#container").append(table);
            });
            function PrintElem() {
                var mywindow = window.open('', 'PRINT', 'height=400,width=600');
    
                mywindow.document.write('<html><head>');
                mywindow.document.write('</head><body >');
                mywindow.document.write('<h1>Todays Report Dated ' + document.getElementById("txtDate").value + '</h1>');
                mywindow.document.write(document.getElementById("GV1").outerHTML);
                mywindow.document.write(document.getElementById("GridView1").outerHTML);
                mywindow.document.write('</body></html>');
    
                mywindow.document.close(); // necessary for IE >= 10
                mywindow.focus(); // necessary for IE >= 10*/
    
                mywindow.print();
                mywindow.close();
    
                return true;
            }
        </script>
        
    </head>
    <body style="font-size: 12pt; font-family: Times New Roman">
        <form id="form1" runat="server">
        <div>
        
      <div id="container" style=" overflow: scroll; overflow-x: hidden">
        </div>
            <input type="text" id="txtDate" />
            <input id="Print" type="button" value="print" onclick="PrintElem()" />
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#404040"
                            BorderStyle="Solid" EnableModelValidation="True"
                            Font-Bold="True" Font-Names="Palatino Linotype"  Font-Size="11pt" Width="620px" Height="80px" ShowFooter="True">
                    <Columns>
                        <asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item">
                            <ItemStyle HorizontalAlign="Left" Width="140px" />
                            <HeaderStyle HorizontalAlign="Center" Width="140px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="140px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Date">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Qty" HeaderText="Qty" SortExpression="Side">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Taken" HeaderText="Taken" SortExpression="Calfs">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                            <HeaderStyle HorizontalAlign="Center" Width="50px" BackColor="White" ForeColor="Red" />
                            <ControlStyle   Width="50px" />
                        </asp:BoundField>
                       
                        
                         <asp:TemplateField HeaderText="Out Time">
                                    <ItemTemplate>
                                        <asp:Label ID="Text1" runat="server" Text='<%# Bind("Out_Time") %>'></asp:Label>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:Label ID="FText12" runat="server" ForeColor="Blue" Text="Total"></asp:Label>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Taken Quantity">
                                    <ItemTemplate>
                                        <asp:TextBox ID="Text1"  Font-Size="Large" Width="100px" ForeColor="Red" runat="server"></asp:TextBox>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    <asp:TextBox ID="FText1" Width="100px" runat="server"></asp:TextBox>
                                    </FooterTemplate>
                                    <HeaderStyle ForeColor="Blue" />
                                    <ItemStyle Width="120px" />
                                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            <br />
        </div>
        </form>
    </body>
    </html>

    This should make the date value dynamic and the unperfect of the print, like below:

    Best Regard,

    Yang Shen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 23, 2019 3:21 AM