Added search function to Medication Search Page with working gridview

This commit is contained in:
cadenjmoore
2024-04-01 19:17:05 -04:00
parent 2680e87e2c
commit 39023fcdf8
9 changed files with 133 additions and 29 deletions

View File

@@ -2,26 +2,21 @@
<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 src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(document).keypress(function(e) {
if (e.which === 13) { // Enter key = keycode 13
e.preventDefault(); // Prevent the default Enter action
$("#<%= btnMediSearch.ClientID %>").click(); // Trigger the search button click
}
});
});
</script>
<link type="text/css" href="main.css"/>
<h1 style="text-align: center; font-size: 44px">
Medications
@@ -61,15 +56,23 @@
</div>
<asp:GridView runat="server" ID="gvMedication" BorderColor="white" AutoGenerateColumns="False" OnSelectedIndexChanged="gvMedication_OnSelectedIndexChanged"
OnRowDataBound="gvMedication_OnRowDataBound">
<asp:GridView runat="server" ID="gvMedication" CssClass="gridview"
HeaderStyle-CssClass="headerstyle"
RowStyle-CssClass="rowstyle"
AlternatingRowStyle-CssClass="alternatingrowstyle"
SelectedRowStyle-CssClass="selectedrowstyle"
OnRowCommand="gvMedication_OnRowCommand"
AutoGenerateColumns="False"
OnRowDataBound="gvMedication_OnRowDataBound"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<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"/>
<asp:BoundField DataField="MedicationName" HeaderText="Medication Name" ItemStyle-Width="100px"/>
<asp:BoundField DataField="IntakeMethod" HeaderText="Intake Method" ItemStyle-Width="100px"/>
<asp:BoundField DataField="Frequency" HeaderText="Frequency" ItemStyle-Width="100px"/>
<asp:BoundField DataField="Dosage" HeaderText="Dosage" ItemStyle-Width="100px"/>
<asp:BoundField DataField="Purpose" HeaderText="Purpose" ItemStyle-Width="100px"/>
<asp:BoundField DataField="RxNum" HeaderText="RxNum" ItemStyle-Width="100px"/>
</Columns>
</asp:GridView>