Please help my modal popup does not show
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Submit.aspx.vb" Inherits="UMMB.Submit" %>
<!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 id="Head1" runat="server">
<title></title>
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" />
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style6">
<tr>
<td class="auto-style12">
<asp:Label ID="LoggedIn" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style12">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table class="auto-style1">
<tr>
<td>Category</td>
<td class="auto-style9">
<asp:DropDownList ID="Category" runat="server" AutoPostBack="True" Height="23px" Width="164px">
</asp:DropDownList>
</td>
<td class="auto-style8">
<asp:Label ID="Show" runat="server" Text="Label"></asp:Label>
</td>
<td class="auto-style8">
<asp:Label ID="Account" runat="server" Text="Label"></asp:Label>
</td>
<td class="auto-style8">
<asp:Label ID="Userslogin" runat="server" Text="Label" Visible="False"></asp:Label>
</td>
<td rowspan="4">
<img alt="" class="auto-style7" longdesc="http://localhost:56557/images/UMMB LOGO.png" src="../images/UMMB%20LOGO.png" />
</td>
</tr>
<tr>
<td>H.Facility</td>
<td class="auto-style5">
<asp:DropDownList ID="Category0" runat="server" AutoPostBack="True" Height="23px" Width="164px">
</asp:DropDownList>
</td>
<td colspan="3">
<asp:Button ID="Button2" runat="server" Text="Management" />
</td>
</tr>
<tr>
<td>Date</td>
<td class="auto-style5">
<asp:TextBox ID="Dates" runat="server" CssClass="auto-style4" Width="157px"></asp:TextBox>
</td>
<td colspan="3">
<asp:Button ID="Button1" runat="server" Text="Submit" />
</td>
</tr>
<tr>
<td>Amount</td>
<td class="auto-style5">
<asp:TextBox ID="Amount" runat="server" Width="158px"></asp:TextBox>
</td>
<td colspan="3">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="auto-style12">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<div class="container">
<div class="table-responsive">
<asp:GridView ID="SubmissionGrd" runat="server" AutoGenerateColumns="False" CssClass="table table-bordered table-hover table-striped thead-dark GridCustomers" Width="631px">
<Columns>
<asp:TemplateField HeaderText="Station">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Station") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Station" runat="server" Text='<%# Bind("Station") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Category") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Category1" runat="server" Text='<%# Bind("Category") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Dates">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Dates") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Dates0" runat="server" Text='<%# Bind("Dates") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="amount">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("amount") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="amount0" runat="server" Text='<%# Bind("amount") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Entrycode">
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("atk") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("atk") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="False">
<ItemTemplate>
<asp:LinkButton ID="lnkEdit" runat="server" data-target="#MyPopup" data-toggle="modal" href="#">Edit</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:LinkButton ID="lnkBtnEdit" runat="server" CssClass="btn btn-info" OnClick="Display" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<table class="auto-style10">
<tr>
<td class="auto-style13">Date</td>
<td class="auto-style11">
<asp:TextBox ID="ExtractDates" runat="server" CssClass="auto-style4" Width="124px"></asp:TextBox>
<asp:Button ID="Button3" runat="server" Text="Show Submissions" />
</td>
<td class="auto-style11">
<asp:Button ID="Button6" runat="server" Text="Button" />
</td>
<td class="auto-style14">
<asp:Button ID="Button4" runat="server" Text="Print" />
</td>
</tr>
<tr>
<td colspan="4">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CssClass="footable" Style="max-width: 500px">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Customer Id" />
<asp:BoundField DataField="Name" HeaderText="Customer Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:BoundField DataField="Salary" HeaderText="Salary" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
<div id="MyPopup" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×</button>
<h4 class="modal-title">Update </h4>
</div>
<div class="modal-body">
<table class="table table-bordered table-hover table-striped thead-dark">
<tr>
<td>admno
</td>
<td>
<asp:TextBox runat="server" ID="admno" CssClass="form-control" />
</td>
<td class="auto-style5">Name
</td>
<td>
<asp:TextBox runat="server" ID="txtName" CssClass="form-control" Style="margin-left: 0px" Width="226px" />
</td>
</tr>
<tr>
<td>Class</td>
<td>
<asp:TextBox runat="server" ID="txtCountry" CssClass="form-control" />
</td>
<td class="auto-style5">Stream</td>
<td>
<asp:TextBox runat="server" ID="Stream" CssClass="form-control" Style="margin-left: 0px" Width="226px" />
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<asp:Button ID="btnUpdate" Text="Update" runat="server" CssClass="btn btn-primary" OnClick="OnUpdate" />
<asp:Button ID="Button5" Text="Close" runat="server" CssClass="btn btn-danger" OnClick="Displayclose" />
</div>
</div>
</div>
</div>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
$("[id*=lnkEdit]").click(function () {
$('[id*=admno]').val($(this).closest('tr').find('td').eq(0).html());
$('[id*=txtName]').val($(this).closest('tr').find('td').eq(1).html());
$('[id*=txtCountry]').val($(this).closest('tr').find('td').eq(2).html());
$('[id*=Stream]').val($(this).closest('tr').find('td').eq(3).html());
$('#MyPopup').modal('show');
return false;
});
</script>
<script type='text/javascript'>
function openModal() {
$('[id*=MyPopup]').modal('show');
}
</script>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
</form>
</body>
</html>
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Globalization
Public Class Submit
Inherits System.Web.UI.Page
Dim constr As String = ConfigurationManager.ConnectionStrings("UMSBConnectionString").ConnectionString
Dim Status As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Try
Dim currentd As System.DateTime = System.DateTime.Now
Dates.Text = currentd.Date.ToString("dd/MM/yyyy")
Catch
End Try
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "SendToStations"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT account, title,atk FROM Allaccounts")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
Category.DataSource = cmd.ExecuteReader()
Category.DataTextField = "title"
Category.DataValueField = "atk"
Category.DataBind()
con.Close()
End Using
End Using
Category.Items.Insert(0, New ListItem("--Select Category--", "0"))
Try
LoggedIn.Text = "Current Login :" & Session("currentuser").ToString
Userslogin.Text = Session("currentuser").ToString
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT Username,Station,Category FROM Stations WHERE UserName = '" & Userslogin.Text & "'", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
RDR2.Read()
Status = RDR2.Item("Category").ToString
If String.IsNullOrEmpty(Status) Then
Button2.Visible = False
Else
Button2.Visible = True
End If
Dim country As String = RDR2.Item("Station").ToString
Category0.Items.Insert(0, New ListItem(country, "0"))
Category0.SelectedItem.Text = country
End If
End Using
End Using
Con.Close()
End Using
Catch
End Try
End If
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If String.IsNullOrEmpty(Amount.Text) Then
Dim time23 As String = "You Must Indicate The Amount"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Amount.Focus()
Else
If String.IsNullOrEmpty(Dates.Text) Then
Dim time23 As String = "You Must indicate the Date"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Dates.Focus()
Else
If Category.SelectedItem.Text = "--Select Category--" Then
Dim time23 As String = "You Must Selected the Items from the List"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Category.Focus()
Else
If String.IsNullOrEmpty(Category0.SelectedItem.Text) Then
Dim time23 As String = "You Must Register Your Duty Station Please Contact the Administrator"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Category0.Focus()
Else
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "createAUDIT"
cmd.Parameters.Add("@n", SqlDbType.NVarChar).Value = Userslogin.Text
cmd.Parameters.Add("@st", SqlDbType.NVarChar).Value = Account.Text
cmd.Parameters.Add("@s", SqlDbType.NVarChar).Value = Amount.Text
cmd.Parameters.Add("@a", SqlDbType.NVarChar).Value = Show.Text
cmd.Parameters.Add("@cd", SqlDbType.NVarChar).Value = Category.SelectedItem.Text
cmd.Parameters.Add("@sp", SqlDbType.NVarChar).Value = Dates.Text
cmd.Parameters.Add("@spt", SqlDbType.NVarChar).Value = Category0.SelectedItem.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Dim time23 As String = "Record Submited Successfully"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Amount.Text = ""
Category.ClearSelection()
Show.Text = ""
Account.Text = ""
End If
End If
End If
End If
End Sub
Protected Sub BindGrid2023()
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
cmd.CommandText = "SELECT *FROM Postserialnumberaccreg"
cmd.Connection = con
' cmd.Parameters.AddWithValue("@autono", Entrycode.Text.Trim())
Dim dt As New DataTable()
Using sda As New SqlDataAdapter(cmd)
sda.Fill(dt)
If dt.Rows.Count > 0 Then
GridView1.DataSource = dt
GridView1.DataBind()
GridView1.UseAccessibleHeader = True
GridView1.FooterRow.TableSection = TableRowSection.TableFooter
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader
' Loadedbk.Text = gvCustomers.Rows.Count
Else
Dim time23 As String = "No Records Loaded"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
' Transferlist.DataSource = Nothing
GridView1.DataBind()
'Transferlist.Visible = False
Exit Sub
End If
End Using
End Using
End Using
End Sub
Protected Sub Category_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Category.SelectedIndexChanged
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT types,account FROM Allaccounts WHERE title = '" & Category.SelectedItem.Text & "'", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
RDR2.Read()
Show.Text = RDR2.Item("types").ToString
Account.Text = RDR2.Item("account").ToString
End If
End Using
End Using
Con.Close()
End Using
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Response.Redirect(String.Format("~/Forms/Reporting.aspx"))
End Sub
Private Sub BindGridDiagnosis()
Dim cmd As New SqlCommand("SELECT Users, Station, Amount, Types, Category, Dates,atk FROM Audit where Category=@c and Station=@b and Dates=CONVERT(datetime,@d,103)")
cmd.Parameters.AddWithValue("@c", Category.SelectedItem.Text)
cmd.Parameters.AddWithValue("@b", Category0.SelectedItem.Text)
cmd.Parameters.AddWithValue("@d", Dates.Text)
SubmissionGrd.DataSource = Me.ExecuteQuery(cmd, "SELECT")
SubmissionGrd.DataBind()
End Sub
Private Function ExecuteQuery(cmd As SqlCommand, action As String) As DataTable
Dim conString As String = ConfigurationManager.ConnectionStrings("UMSBConnectionString").ConnectionString
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.ExecuteNonQuery()
con.Close()
Exit Select
End Select
Return Nothing
End Using
End Function
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
BindGridDiagnosis()
End Sub
Protected Sub DisplayAccount(sender As Object, e As EventArgs)
Dim rowIndex As Integer = Convert.ToInt32(TryCast(TryCast(sender, LinkButton).NamingContainer, GridViewRow).RowIndex)
Dim row As GridViewRow = GridView1.Rows(rowIndex)
' admno.Text = TryCast(row.FindControl("admno"), Label).Text
' txtName.Text = TryCast(row.FindControl("Name"), Label).Text
' txtCountry.Text = TryCast(row.FindControl("Class"), Label).Text
Session("admno") = TryCast(row.FindControl("admno"), Label).Text
Session("Name") = TryCast(row.FindControl("Name"), Label).Text
Response.Redirect("~/Forms/Cashinfo.aspx")
End Sub
Protected Sub Displayclose(sender As Object, e As EventArgs)
SubmissionGrd.UseAccessibleHeader = True
SubmissionGrd.HeaderRow.TableSection = TableRowSection.TableHeader
End Sub
Protected Sub OnUpdate(ByVal sender As Object, ByVal e As EventArgs)
' Code to update the record.
Dim id As String = Request.Form("txtId")
Dim name As String = Request.Form("txtName")
Dim country As String = Request.Form("txtCountry")
Dim categoryad As String = Request.Form("admno")
Dim usernamex As String = Session("Username").ToString()
' Categorym.Text = Request.Form("Categoryddl")
' Names.Text = name
' Countrys.Text = country
If String.IsNullOrEmpty(Stream.Text) Then
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('You Must Indicate the Stream');", True)
Stream.Focus()
ClientScript.RegisterStartupScript(Me.[GetType](), "Pop", "openModal();", True)
Exit Sub
End If
Using Cont As New SqlConnection(constr)
Cont.Open()
Using cmd As New SqlCommand
cmd.Connection = Cont
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "PushpayuPDATE"
cmd.Parameters.Add("@a", SqlDbType.NVarChar).Value = admno.Text
' cmd.Parameters.Add("@ct", SqlDbType.NVarChar).Value = Categoryddl.SelectedItem.Text
' cmd.Parameters.Add("@p", SqlDbType.NVarChar).Value = Dllparticulars.SelectedItem.Text
cmd.ExecuteReader()
Cont.Close()
End Using
End Using
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('Record Saved Successfully');window.location ='" + Request.Url.AbsoluteUri + "';", True)
' GridView1.UseAccessibleHeader = True
' GridView1.HeaderRow.TableSection = TableRowSection.TableHeader
End Sub
Protected Sub Display(sender As Object, e As EventArgs)
Dim rowIndex As Integer = Convert.ToInt32(TryCast(TryCast(sender, LinkButton).NamingContainer, GridViewRow).RowIndex)
Dim row As GridViewRow = SubmissionGrd.Rows(rowIndex)
admno.Text = TryCast(row.FindControl("Station"), Label).Text
admno.ReadOnly = True
txtName.Text = TryCast(row.FindControl("Category1"), Label).Text
txtName.ReadOnly = True
' txtCountry.Text = TryCast(row.FindControl("Class"), Label).Text
' Stream.Text = TryCast(row.FindControl("Stream"), Label).Text
' txtAmount.Text = TryCast(row.FindControl("lblAmount"), Label).Text
ClientScript.RegisterStartupScript(Me.[GetType](), "Pop", "openModal();", True)
End Sub
Protected Sub Displayquit(sender As Object, e As EventArgs)
Response.Redirect(Request.Url.AbsoluteUri)
SubmissionGrd.UseAccessibleHeader = True
SubmissionGrd.HeaderRow.TableSection = TableRowSection.TableHeader
End Sub
Protected Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
BindGridDiagnosis()
End Sub
End Class