I am trying to use datatables but when i run the page the search ficility does not come.
The page doesnot show any error while loading
please help
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Forms/Site1.Master" CodeBehind="SingleItem.aspx.vb" Inherits="UNIFORMSWEBAPP.SingleItem" %>
<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">
<script type="text/javascript">
function Showalert() {
alert('Call JavaScript function from codebehind');
}
</script>
<script type="text/javascript">
function Confirm(message) {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm(message)) {
confirm_value.value = "Yes";
}
else {
confirm_value.value = "No";
}
document.forms[0].appendChild(confirm_value);
document.getElementById('Button5').click();
}
</script>
<body>
<div>
</div>
<asp:Panel ID="Panel1" runat="server" Height="79px">
<table cellpadding="2" class="auto-style1">
<tr>
<td class="auto-style3">Item code</td>
<td class="auto-style4">
<asp:Label ID="PatientNo" runat="server" Text="Item Code"></asp:Label>
</td>
<td class="auto-style2" colspan="2">Stock Item</td>
<td class="auto-style2" colspan="3">
<asp:Label ID="PatientName" runat="server" Text="Stock Item"></asp:Label>
</td>
<td class="auto-style7">Date</td>
<td class="auto-style2">
<asp:TextBox ID="Dates" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style3"> From:</td>
<td class="auto-style4" colspan="2">
<asp:TextBox ID="Froms" runat="server"></asp:TextBox>
</td>
<td class="auto-style11">To:</td>
<td class="auto-style8" colspan="2">
<asp:TextBox ID="Tot" runat="server"></asp:TextBox>
</td>
<td class="auto-style10"> </td>
<td class="auto-style2" colspan="2">
<asp:TextBox ID="Particulars" runat="server" Width="181px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server" Text="Save Billing" Visible="False" />
<asp:Button ID="Button5" runat="server" style="display:none;" />
</td>
<td class="auto-style4" colspan="2"> </td>
<td class="auto-style11">Trcode</td>
<td class="auto-style6">
<asp:Label ID="Trcode" runat="server" Text="Trcode"></asp:Label>
</td>
<td class="auto-style6">
<asp:Button ID="Button7" runat="server" Text="Back to Menu" />
</td>
<td class="auto-style6">
<asp:Button ID="Button6" runat="server" Text="Print Stock Movement" />
</td>
<td class="auto-style2">Username</td>
<td class="auto-style2">
<asp:Label ID="Username" runat="server" Text="Username"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2" colspan="9">
<asp:GridView ID="StudentGrid" runat="server" AutoGenerateColumns="False" Width="909px">
<Columns>
<asp:BoundField DataField="itemcode" HeaderText="Item Code" />
<asp:BoundField DataField="Stockitem" HeaderText="Stock Name" />
<asp:BoundField DataField="section" HeaderText="Category" />
<asp:BoundField DataField="subcategory" HeaderText="SubCategory" />
<asp:ButtonField CommandName="Select" HeaderText="Select" ShowHeader="True" Text="Select" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</asp:Panel>
</body>
</html>
<link rel="stylesheet" href="../BootStrap/Css/BootStrap3.3.2.css" />
<script type="text/javascript" src="../BootStrap/Jquery3.4.1.js"></script>
<script type="text/javascript" src="../BootStrap/Bootstrap3.3.2.min.js"></script>
<script type="text/javascript" src="../BootStrap/Jquery.Datatables.1.10.20.js"></script>
<link href="../BootStrap/Css/1.10.20.jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/inputmask.min.js"></script>
<script src="../Scripts/inputmask.date.extensions.min.js"></script>
<script src="../Scripts/inputmask.extensions.min.js"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/inputmask.css"/>
<script type="text/javascript">
jQuery(function myfuctionsula ($){
var inputmask = new Inputmask("99/99/9999", { placeholder: 'dd/mm/yyyy' });
inputmask.mask($('[id*=Froms]'));
inputmask.mask($('[id*=Tot]'));
});
</script>
<script type="text/javascript">
$(function () {
$(".StudentGrid").DataTable({
bLengthChange: true,
lengthMenu: [[10, 15, -1], [10, 15, "All"]],
bFilter: true,
bSort: true,
bPaginate: true
});
});
</script>
</asp:Content>
Imports System.Data
Imports System.Web.Services
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Threading
Public Class SingleItem
Inherits System.Web.UI.Page
Dim conString As String = ConfigurationManager.ConnectionStrings("UNIFORMConnectionString").ConnectionString
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindGrid()
Dim currentdt As System.DateTime = System.DateTime.Now
Dates.Text = currentdt.Date.ToString("dd/MM/yyyy")
' Username.Text = Session("currentuser").ToString
Dim currentd2 As System.DateTime = System.DateTime.Now
If Froms.Text = "" Then
Froms.Text = currentd2.Date.ToString("dd/MM/yyyy")
' txtLogged.Text = aDateTime.ToString("dd/MM/yyyy")
End If
If Tot.Text = "" Then
Dim currentdtb As System.DateTime = System.DateTime.Now
Tot.Text = currentdtb.AddDays(1).ToString("dd/MM/yyyy")
End If
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 Sub BindGrid()
Dim constr As String = ConfigurationManager.ConnectionStrings("UNIFORMConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT*FROM Stockcodes", con)
Using sda As New SqlDataAdapter(cmd)
cmd.CommandType = CommandType.Text
Dim dt As New DataTable()
sda.Fill(dt)
StudentGrid.DataSource = dt
StudentGrid.DataBind()
StudentGrid.UseAccessibleHeader = True
StudentGrid.HeaderRow.TableSection = TableRowSection.TableHeader
End Using
End Using
End Using
End Sub
Private Sub StudentGrid_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles StudentGrid.RowCommand
If e.CommandName = "Select" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = StudentGrid.Rows(index)
Dim admno As String = StudentGrid.Rows(index).Cells(0).Text
Dim namesd As String = StudentGrid.Rows(index).Cells(1).Text
Dim docment As String = StudentGrid.Rows(index).Cells(2).Text
PatientNo.Text = admno
PatientName.Text = namesd
bindgrid()
'Session("admno") = admno
'Session("Names") = names
' Session("Age") = age
' Session("ptype") = Ptype
' Session("sex") = Phonet
'Response.Redirect(String.Format("~/Forms/Diagnosis.aspx?admno={0}&Names={1}&Age={2}&Ptype={3}&sex={4}", admno, names, valueclass, valuestream, Phonet))
' Response.Redirect(String.Format("~/Forms/Nurse.aspx"))
Exit Sub
End If
End Sub
Protected Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Response.Redirect("~/Forms/StockOperations.aspx")
End Sub
Protected Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Using Con As New SqlConnection(conString)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "daterangecapture"
cmd.Parameters.Add("@f", SqlDbType.NVarChar).Value = Froms.Text
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = Tot.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(conString)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "glsttstockV4"
cmd.Parameters.Add("@i", SqlDbType.NVarChar).Value = PatientNo.Text
cmd.Parameters.Add("@f", SqlDbType.NVarChar).Value = Froms.Text
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = Tot.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(conString)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Runningbalancestock"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Session("categoryReport") = "Statement Single Item"
'Session("Froms0") = Froms.Text
'Session("Tos0") = Tots.Text
'Session("account") = PatientNo.Text
Response.Redirect(String.Format("~/Reports/DisplayReports.aspx"))
End Sub
End Class