I am getting this error while loading table please help
DataTables warning: Non-table node initialisation (SPAN). For more information about this error, please see http://datatables.net/tn/2
 
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master" CodeBehind="Subcodes.aspx.vb" Inherits="SLISWEB2023.Subcodes1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <title></title>
    <style type="text/css">
        .auto-style1 { width: 100%; border-collapse: collapse; border-style: solid; border-width: 2px; background-color: #00FFFF; }
        .auto-style2 { background-color: #FFFFFF; }
        .auto-style3 { width: 100%; }
        .auto-style23 { height: 12px; }
    </style>
    <style type="text/css">
        body { font-family: Arial; font-size: 10pt; }
        .modalBackground { background-color: Black; filter: alpha(opacity=40); opacity: 0.4; }
        .modalPopup { background-color: #FFFFFF; width: 300px; border: 3px solid #0DA9D0; }
            .modalPopup .header { background-color: #2FBDF1; height: 30px; color: White; line-height: 30px; text-align: center; font-weight: bold; }
            .modalPopup .body { min-height: 50px; line-height: 30px; text-align: center; padding: 5px; }
            .modalPopup .footer { padding: 3px; }
            .modalPopup .button { height: 23px; color: White; line-height: 23px; text-align: center; font-weight: bold; cursor: pointer; background-color: #9F9F9F; border: 1px solid #5C5C5C; }
            .modalPopup td { text-align: left; }
        .auto-style70 { width: 224px; height: 22px; }
        .auto-style71 { color: #FF5050; }
    </style>
     
    <script type="text/javascript">
        function Showalert() {
            alert('Call JavaScript function from codebehind');
        }
    </script>
    <script type="text/javascript">
        function askConfirm(msg) {
            alert(msg)
        }
    </script>
    <body>
         <script type="text/javascript" src="../Scripts/Jquery-3.5.1.js"></script>
    <script type="text/javascript" src="../Scripts/Jquery.datatables.min.js"></script>
    <script type="text/javascript" src="../Scripts/datatable.fixedColumns.min.js"></script>
  
         <link href="../Scripts/Jquery.datatables.min.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/fixedColumns.dataTables.min.css" rel="stylesheet" type="text/css" />
 
        <div>
            <table class="auto-style1">
                <tr>
                    <td>
                        <asp:Button ID="Button2" runat="server" Text="Back To Menu" />
                    </td>
                    <td> </td>
                    <td> </td>
                    <td> </td>
                </tr>
                <tr>
                    <td colspan="4" class="auto-style2">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:ScriptManager ID="ScriptManager1" runat="server">
                                </asp:ScriptManager>
                                <asp:GridView ID="StockbooksGrid" runat="server" AutoGenerateColumns="False" Width="1307px" ShowFooter="True">
                                    <Columns>
                                        <asp:ButtonField CommandName="Editbook" Text="Edit " />
                                        <asp:TemplateField HeaderText="CallNo">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("bookcode") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="Callno" runat="server" Text='<%# Bind("bookcode") %>' Width="73px"></asp:TextBox>
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Callno" runat="server" Text='<%# Bind("bookcode") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Book Name">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("bookname") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="Fbookname" runat="server" Text='<%# Bind("bookcode") %>' Width="349px"></asp:TextBox>
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="BookName" runat="server" Text='<%# Bind("bookname") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Author">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("author") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="Fauthor" runat="server" Text='<%# Bind("bookcode") %>' Width="210px"></asp:TextBox>
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Author" runat="server" Text='<%# Bind("author") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Subject">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("category") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:DropDownList ID="DropDownList1" runat="server" Height="27px" Width="243px" DataSourceID="bksubjects" DataTextField="subject" DataValueField="subject" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                                                </asp:DropDownList>
                                                <asp:SqlDataSource ID="bksubjects" runat="server" ConnectionString="<%$ ConnectionStrings:SLISConnectionString %>" SelectCommand="SELECT [subject] FROM [subjects]"></asp:SqlDataSource>
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Subject" runat="server" Text='<%# Bind("category") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="EntryCode">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("autofield") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:Button ID="Button1" runat="server" Text="Add New" OnClick="Button1_Click" />
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Entrycode" runat="server" Text='<%# Bind("autofield") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Publisher">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Publisher") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Publisher" runat="server" Text='<%# Bind("Publisher") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Year Published" Visible="False">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Yearpublished") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="YearPublished" runat="server" Text='<%# Bind("Yearpublished") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="ISBN" Visible="False">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ISBN") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="ISBN" runat="server" Text='<%# Bind("ISBN") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Edition">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Editions") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Editions" runat="server" Text='<%# Bind("Editions") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                            <ContentTemplate>
                                <table class="auto-style3">
                                    <tr>
                                        <td class="auto-style23">
                                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" AutoPostBack="True">
                                                <asp:ListItem>None</asp:ListItem>
                                                <asp:ListItem>Import Books From Excel</asp:ListItem>
                                                <asp:ListItem>Batch Transfer  Accession numbers</asp:ListItem>
                                                <asp:ListItem>Transfer  Selected Accession numbers</asp:ListItem>
                                                <asp:ListItem Value="Delete Single Accesssion No">Delete Single Accesssion No</asp:ListItem>
                                                <asp:ListItem>Transfer Single Accession numbers</asp:ListItem>
                                            </asp:RadioButtonList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Label ID="Currentusertxt" runat="server" Text="Current Username"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td> </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                            <Triggers>
                                <asp:PostBackTrigger ControlID="btnYes" />
                                <asp:PostBackTrigger ControlID="btnNo" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
                        <cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="mpe" runat="server"
                            PopupControlID="pnlPopup" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground"
                            CancelControlID="btnCancel">
                        </cc1:ModalPopupExtender>
                    </td>
                    <td> </td>
                    <td> </td>
                    <td> </td>
                </tr>
            </table>
            <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
                <div class="header">
                    <asp:Button ID="btnCancel" runat="server" Text="X" Style="float: right;" />
                </div>
                <div class="body">
                    <asp:Label ID="lblMessage" runat="server" Text="" />
                    <br />
                </div>
                <div class="footer" style="text-align: center;">
                    <asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="OnYes" />
                    <asp:Button ID="btnNo" runat="server" Text="No" OnClick="OnNo" />
                </div>
            </asp:Panel>
        </div>
        
         <script type="text/javascript">
        $(function () {
            $("[id*=StockbooksGrid]").DataTable({
                bLengthChange: true,
                lengthMenu: [[10, 30, -1], [10, 30, "All"]],
                bFilter: true,
                bSort: true,
                bPaginate: true
            });
        });
    </script>
        <script type="text/javascript">
            //On UpdatePanel Refresh
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            if (prm != null) {
                prm.add_endRequest(function (sender, e) {
                    if (sender._postBackSettings.panelsToUpdate != null) {
                        $('[id$=StockbooksGrid]').prepend($("<thead></thead>").append($('[id$=StockbooksGrid]').find("tr:first"))).DataTable({
                            "responsive": true,
                            "sPaginationType": "full_numbers"
                        });
                    }
                });
            };
        </script>
    </body>
    </html>
</asp:Content>
 
Imports System.Data
Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Configuration
Public Class Subcodes1
    Inherits System.Web.UI.Page
    Dim conString As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
    Dim hold, holdupdaate As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            BindGrid2000()
            'StockbooksGrid.DataBind()
            Try
                Currentusertxt.Text = Session("currentuser").ToString
            Catch
                Response.Redirect("~/FormsV2/DashboardLoader.aspx")
            End Try
        End If
    End Sub
    Private Sub BindGrid2000()
        Dim constr As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand("SELECT top 10 autofield2,autofield,bookcode, bookname, author,category,publisher,yearpublished,isbn,class as Editions FROM stockkabojja ORDER BY autofield ASC", con)
                Using sda As New SqlDataAdapter(cmd)
                    cmd.CommandType = CommandType.Text
                    Dim dt As New DataTable()
                    sda.Fill(dt)
                    StockbooksGrid.DataSource = dt
                    StockbooksGrid.DataBind()
                    StockbooksGrid.UseAccessibleHeader = True
                    'StockbooksGrid.FooterRow.TableSection = TableRowSection.TableFooter
                    StockbooksGrid.HeaderRow.TableSection = TableRowSection.TableHeader
                End Using
            End Using
        End Using
    End Sub
    Private Sub BindGrid()
        Dim cmd As New SqlCommand("SELECT   autofield2,autofield,bookcode, bookname, author,category,publisher,yearpublished,isbn,class as Editions FROM stockkabojja ORDER BY autofield ASC")
        StockbooksGrid.DataSource = Me.ExecuteQuery(cmd, "SELECT")
        StockbooksGrid.DataBind()
        StockbooksGrid.UseAccessibleHeader = True
        StockbooksGrid.FooterRow.TableSection = TableRowSection.TableFooter
        StockbooksGrid.HeaderRow.TableSection = TableRowSection.TableHeader
    End Sub
    Private Sub StockbooksGrid_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles StockbooksGrid.RowCommand
        If e.CommandName = "Editbook" Then
            Dim index As Integer = Convert.ToInt32(e.CommandArgument)
            Dim row As GridViewRow = StockbooksGrid.Rows(index)
            Dim calln As String = DirectCast(StockbooksGrid.Rows(index).Cells(1).FindControl("callno"), Label).Text
            Dim Booknamedata As String = DirectCast(StockbooksGrid.Rows(index).Cells(2).FindControl("BookName"), Label).Text
            Dim Authordata As String = DirectCast(StockbooksGrid.Rows(index).Cells(3).FindControl("Author"), Label).Text
            Dim Subjectdata As String = DirectCast(StockbooksGrid.Rows(index).Cells(4).FindControl("Subject"), Label).Text
            Dim Entrycode As String = DirectCast(StockbooksGrid.Rows(index).Cells(5).FindControl("Entrycode"), Label).Text
            Dim Publisherdata As String = DirectCast(StockbooksGrid.Rows(index).Cells(6).FindControl("Publisher"), Label).Text
            Dim Editionsata As String = DirectCast(StockbooksGrid.Rows(index).Cells(8).FindControl("Editions"), Label).Text
            Dim Yearpublishedsata As String = DirectCast(StockbooksGrid.Rows(index).Cells(7).FindControl("YearPublished"), Label).Text
            Session("callno") = calln
            Session("BookName") = Booknamedata
            Session("Subject") = Subjectdata
            Session("Author") = Authordata
            Session("Entrycode") = Entrycode
            Session("Editions") = Editionsata
            Session("Publisher") = Publisherdata
            Session("Year") = Yearpublishedsata
            Session("Hold") = "Editbook"
            Using Cont As New SqlConnection(conString)
                Cont.Open()
                Using Com2 As New SqlCommand("Select class,phrase,sort,maximum,isbn,ISSN FROM stockkabojja WHERE autofield  = '" & Entrycode & "'", Cont)
                    Using RDR2 = Com2.ExecuteReader()
                        If RDR2.HasRows Then
                            RDR2.Read()
                            Session("Notes") = RDR2.Item("Phrase").ToString()
                            Session("Group") = RDR2.Item("Sort").ToString()
                            Session("retain") = RDR2.Item("maximum").ToString()
                            Session("ISBN") = RDR2.Item("ISBN").ToString()
                            Session("ISSN") = RDR2.Item("ISSN").ToString()
                        End If
                    End Using
                    Cont.Close()
                End Using
            End Using
            Response.Redirect(String.Format("~/FormsV2/Editsubcodes.aspx"))
        End If
    End Sub
    Private Function ExecuteQuery(ByVal cmd As SqlCommand, ByVal action As String) As DataTable
        'Dim conString As String = conString
        Using con As New SqlConnection(conString)
            cmd.Connection = con
            Select Case action
                Case "SELECT"
                    Using sda As New SqlDataAdapter()
                        sda.SelectCommand = cmd
                        Using dt As New DataTable()
                            sda.Fill(dt)
                            Return dt
                        End Using
                    End Using
                Case "UPDATE"
                    con.Open()
                    cmd.ExecuteReader()
                    con.Close()
                    Exit Select
            End Select
            Return Nothing
        End Using
    End Function
    Private Function GetData(ByVal cmd As SqlCommand) As DataTable
        Dim dt As New DataTable()
        Dim con As New SqlConnection(conString)
        Dim sda As New SqlDataAdapter()
        cmd.CommandType = CommandType.Text
        cmd.Connection = con
        con.Open()
        sda.SelectCommand = cmd
        sda.Fill(dt)
        Return dt
    End Function
    Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Response.Redirect("~/FormsV2/DashboardLoader.aspx")
    End Sub
    Protected Sub OnYes(ByVal sender As Object, ByVal e As EventArgs)
        If RadioButtonList1.SelectedItem.Text = "Batch Transfer  Accession numbers" Then
            BindGrid()
            RadioButtonList1.SelectedIndex = -1
            '  ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Book Details Updated to the Database Successfully');", True)
            Response.Redirect(String.Format("~/FormsV2/TransferACN.aspx"))
        ElseIf RadioButtonList1.SelectedItem.Text = "Delete Single Accesssion No" Then
            BindGrid()
            RadioButtonList1.SelectedIndex = -1
            Response.Redirect(String.Format("~/FormsV2/DelSingleAccession.aspx"))
            ' Response.Redirect(Request.Url.AbsoluteUri)
        ElseIf RadioButtonList1.SelectedItem.Text = "Import Books From Excel" Then
            ' BindGrid()
            RadioButtonList1.SelectedIndex = -1
            Response.Redirect(String.Format("~/FormsV2/UploadBooks.aspx"))
        ElseIf RadioButtonList1.SelectedItem.Text = "Transfer Single Accession numbers" Then
            BindGrid()
            RadioButtonList1.SelectedIndex = -1
            '  ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Book Details Updated to the Database Successfully');", True)
            Response.Redirect(String.Format("~/FormsV2/Transferacno.aspx"))
        Else RadioButtonList1.SelectedIndex = -1
            Dim time22 As String = "SORRY NO RECORDS TO POST"
            ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time22 & "');", True)
            Exit Sub
        End If
    End Sub
    Protected Sub RadioButtonList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadioButtonList1.SelectedIndexChanged
        If RadioButtonList1.SelectedItem.Text = "Back To Menu" Then
            Response.Redirect("~/FormsV2/Subcodes.aspx")
        ElseIf RadioButtonList1.SelectedItem.Text = "Batch Transfer  Accession numbers" Then
            holdupdaate = "Are you Sure You Want to Transfer  Accession numbers ?"
            lblMessage.Text = "Are you Sure You Want to Transfer  Accession numbers ?"
            ModalPopupExtender1.Show()
        ElseIf RadioButtonList1.SelectedItem.Text = "Delete Single Book" Then
            Using Con As New SqlConnection(conString)
                Con.Open()
                Using cmd As New SqlCommand
                    cmd.Connection = Con
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.CommandText = "delsingleentry"
                    '  cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
                    cmd.ExecuteReader()
                    Con.Close()
                End Using
            End Using
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Accession Numbers Deleted Successfully');", True)
        ElseIf RadioButtonList1.SelectedItem.Text = "Delete Single Accesssion No" Then
            lblMessage.Text = "Are you Sure You Want to Delete Accession Numbers ?"
            ModalPopupExtender1.Show()
        ElseIf RadioButtonList1.SelectedItem.Text = "Transfer  Selected Accession numbers" Then
            lblMessage.Text = "Are you Sure you want to Transfer  Selected Accession numbers"
            ModalPopupExtender1.Show()
        ElseIf RadioButtonList1.SelectedItem.Text = "Transfer Single Accession numbers" Then
            lblMessage.Text = "Are you Sure you want to Transfer Single Accession numbers"
            ModalPopupExtender1.Show()
        ElseIf RadioButtonList1.SelectedItem.Text = "Import Books From Excel" Then
            lblMessage.Text = "Import Books From Excel"
            ModalPopupExtender1.Show()
        End If
    End Sub
    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)
        Using con As New SqlConnection(conString)
            Using cmd As New SqlCommand("UpdatestockkabojjaeNTRY", con)
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Parameters.AddWithValue("@k", DirectCast(StockbooksGrid.FooterRow.FindControl("dropdownlist1"), DropDownList).Text.Trim())
                cmd.Parameters.AddWithValue("@a", DirectCast(StockbooksGrid.FooterRow.FindControl("fauthor"), TextBox).Text.Trim())
                cmd.Parameters.AddWithValue("@bk", DirectCast(StockbooksGrid.FooterRow.FindControl("fbookname"), TextBox).Text.Trim())
                cmd.Parameters.Add("@b", SqlDbType.VarChar, 50)
                cmd.Parameters("@b").Direction = ParameterDirection.Output
                con.Open()
                cmd.ExecuteNonQuery()
                con.Close()
                If DirectCast(StockbooksGrid.FooterRow.FindControl("callno"), TextBox).Text = cmd.Parameters("@b").Value.ToString() Then
                    DirectCast(StockbooksGrid.FooterRow.FindControl("callno"), TextBox).Text = cmd.Parameters("@b").Value.ToString()
                Else
                    DirectCast(StockbooksGrid.FooterRow.FindControl("callno"), TextBox).Text = cmd.Parameters("@b").Value.ToString()
                End If
            End Using
        End Using
    End Sub
    Protected Sub OnNo(ByVal sender As Object, ByVal e As EventArgs)
        RadioButtonList1.SelectedIndex = -1
        ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Operation Cancelled');", True)
        ' If Not IsPostBack Then
        Me.BindGrid()
        StockbooksGrid.UseAccessibleHeader = True
        StockbooksGrid.FooterRow.TableSection = TableRowSection.TableFooter
        StockbooksGrid.HeaderRow.TableSection = TableRowSection.TableHeader
        'Currentusertxt.Text = Session("currentuser").ToString
        ' End If
    End Sub
    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Dim Callno As String = DirectCast(StockbooksGrid.FooterRow.FindControl("callno"), TextBox).Text
        Dim bookname As String = DirectCast(StockbooksGrid.FooterRow.FindControl("fbookname"), TextBox).Text
        Dim Author As String = DirectCast(StockbooksGrid.FooterRow.FindControl("fauthor"), TextBox).Text
        Dim subject As String = DirectCast(StockbooksGrid.FooterRow.FindControl("dropdownlist1"), DropDownList).Text
        'Second batch
        ' Dim publisher As String = DirectCast(StockbooksGrid.FooterRow.FindControl("publishers"), TextBox).Text
        '  Dim ypublisher As String = DirectCast(StockbooksGrid.FooterRow.FindControl("yrpublished"), TextBox).Text
        ' Dim ISBN As String = DirectCast(StockbooksGrid.FooterRow.FindControl("TextISBN"), TextBox).Text
        '  Dim retained As String = DirectCast(StockbooksGrid.FooterRow.FindControl("Mretain"), TextBox).Text
        '  Dim edition As String = DirectCast(StockbooksGrid.FooterRow.FindControl("Dropdownlist3"), DropDownList).Text
        ' Dim bkgroup As String = DirectCast(StockbooksGrid.FooterRow.FindControl("Dropdownlist4"), DropDownList).Text
        If Callno = "" Or bookname = "" Or Author = "" Then
            ' ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('You Must Enter Book Details Before Clicking this Button');", True)
            'Me.BindGrid()
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('You Must Enter Book Details Before Clicking this Button');window.location ='Subcodes.aspx';", True)
            ' Response.Redirect("~/Forms/Subcodes.aspx")
            Exit Sub
        Else
            Dim con As New SqlConnection(conString)
            Dim cmd As New SqlCommand()
            cmd.CommandType = CommandType.Text
            '  cmd.CommandText = "insert into Stockkabojja(bookcode,bookName, " &
            ' "author,category,publisher,yearpublished,ISBN,class,date,changed,sort,maximum) values(@bookcode,@bookName,@Author,@category,@publisher,@yrp,@ISBN,@Ed,@d,@c,@g,@r);"
            cmd.CommandText = "insert into Stockkabojja(bookcode,bookName, " &
            "author,category,date,changed) values(@bookcode,@bookName,@Author,@category,@d,@c);"
            cmd.Parameters.Add("@bookcode", SqlDbType.VarChar).Value = Callno
            cmd.Parameters.Add("@bookName", SqlDbType.VarChar).Value = bookname
            cmd.Parameters.Add("@Author", SqlDbType.VarChar).Value = Author
            cmd.Parameters.Add("@Category", SqlDbType.VarChar).Value = subject
            cmd.Parameters.Add("@d", SqlDbType.DateTime).Value = Now
            cmd.Parameters.Add("@c", SqlDbType.NChar).Value = "C"
            ' cmd.ExecuteNonQuery()
            StockbooksGrid.DataSource = GetData(cmd)
            'GridView1.DataBind()
            Me.BindGrid()
            ' ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Book Added to the Database Successfully');", True)
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('Book Added to the Database Successfully');window.location ='Subcodes.aspx';", True)
        End If
    End Sub
End Class