CNSA-216-FP/FWA_MAIN/MediSearch.aspx

170 lines
6.0 KiB
Plaintext
Raw Normal View History

2024-03-21 18:17:57 -04:00
<%@ Page Title="Medication" Language="C#" MasterPageFile="main.master" CodeBehind="MediSearch.aspx.cs" Inherits="FWA_MAIN.MediSearch" %>
2024-03-21 17:26:50 -04:00
2024-03-21 18:17:57 -04:00
<asp:Content runat="server" ContentPlaceHolderID="cph1">
<link type="text/css" href="main.css"/>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
var inputElements = document.getElementsByTagName('input');
for (var i = 0; i < inputElements.length; i++) {
var input = inputElements[i];
if (input.type === 'text') {
input.addEventListener('keydown', function (event) {
if (event.keyCode === 13) { // 13 is the Enter key
event.preventDefault(); // Prevent the default action
document.getElementById('<%= btnMediSearch.ClientID %>').click(); // Trigger button click
}
});
}
}
});
</script>
<h1 style="text-align: center; font-size: 44px">
Medications
</h1>
<div class="medDiv" style="padding-left: 400px">
<div class="medDiv" style="width: 100px; margin-right: 5px">
<div class="indivMedDiv" style="text-align: right;">
<label for="txtFNAME" class="buttonLabel">First Name: </label>
</div>
<br/>
<div class="indivMedDiv" style="text-align: right;">
<label for="txtLNAME" class="buttonLabel">Last Name: </label>
</div>
<br/>
<div class="indivMedDiv" style="text-align: right;">
<label for="txtMedID" class="buttonLabel">Medication ID: </label>
</div>
<br/>
</div>
<div class="medDiv" style="width: 400px">
<div class="indivMedDiv">
<asp:TextBox runat="server" CssClass="defaultTXT" id="txtFNAME"></asp:TextBox>
</div>
<br/>
<div class="indivMedDiv">
<asp:TextBox runat="server" CssClass="defaultTXT" id="txtLNAME"></asp:TextBox>
</div>
<br/>
<div class="indivMedDiv">
<asp:TextBox runat="server" CssClass="defaultTXT" id="txtMedID"></asp:TextBox>
</div>
<br/>
</div>
<br/>
<asp:Button runat="server" ID="btnMediSearch" Text="Search" CssClass="btnMedSearch" OnClick="btnMediSearch_OnClick" />
</div>
<asp:GridView runat="server" ID="gvMedication" BorderColor="white" AutoGenerateColumns="False" OnSelectedIndexChanged="gvMedication_OnSelectedIndexChanged"
OnRowDataBound="gvMedication_OnRowDataBound">
<Columns>
<asp:BoundField DataField="Medication_id" HeaderText="Medication ID" ItemStyle-Width="100px"/>
<asp:BoundField DataField="FirstName" HeaderText="First Name" ItemStyle-Width="100px"/>
<asp:BoundField DataField="LastName" HeaderText="Last Name" ItemStyle-Width="100px"/>
<asp:BoundField DataField="DOB" HeaderText="Date of Birth" ItemStyle-Width="100px"/>
<asp:BoundField DataField="PhoneNumber" HeaderText="Phone Number" ItemStyle-Width="100px"/>
<asp:BoundField DataField="Gender" HeaderText="Gender" ItemStyle-Width="100px"/>
</Columns>
</asp:GridView>
<script type="text/javascript">
document.oncontextmenu = rightClick;
function rightClick(clickEvent) {
clickEvent.preventDefault();
// return false;
}
</script>
<div id="contextMenu" class="context-menu"
style="display: none">
<ul>
<li>
<a href="medNew.aspx">New</a>
</li>
<li>
<a href="medEdit.aspx">Edit</a>
</li>
<li>
<a href="medDelete.aspx">Delete</a>
2024-03-21 18:17:57 -04:00
</li>
<%-- <asp:Button runat="server" Text="New" OnClick="btnNew_OnClick" /> --%>
</ul>
</div>
<script>
document.onclick = hideMenu;
document.oncontextmenu = rightClick;
function hideMenu() {
document.getElementById("contextMenu")
.style.display = "none"
}
function rightClick(e) {
e.preventDefault();
if (document.getElementById("contextMenu").style.display == "block")
hideMenu();
else{
var menu = document.getElementById("contextMenu")
menu.style.display = 'block';
menu.style.left = e.pageX + "px";
menu.style.top = e.pageY + "px";
}
}
</script>
<style type="text/css">
.context-menu {
position: absolute;
text-align: center;
background: lightgray;
border: 1px solid black;
}
.context-menu ul {
padding: 0px;
margin: 0px;
min-width: 150px;
list-style: none;
}
.context-menu ul li {
padding-bottom: 7px;
padding-top: 7px;
border: 1px solid black;
}
.context-menu ul li a {
text-decoration: none;
color: black;
}
.context-menu ul li:hover {
background: darkgray;
}
</style>
<script type="text/javascript">
window.onload = function() {
var grid = document.getElementById("<%= gvMedication.ClientID %>");
var rows = grid.getElementsByTagName("tr");
for (var i = 0; i < rows.length; i++) {
rows[i].onclick = function() {
// Assuming the first cell in every row contains the unique ID
var id = this.cells[0].innerText;
__doPostBack('Select$', id);
};
}
};
</script>
</asp:Content>