CNSA-216-Personal/CH78/Home.aspx

173 lines
7.9 KiB
Plaintext
Raw Permalink Normal View History

2024-03-20 14:09:49 -04:00
<%@ Page Language="C#" CodeBehind="Home.aspx.cs" Inherits="CH78.Home" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="main2.css" rel="stylesheet"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript" language="javascript">
function SelectAll(id)
{
//get reference of GridView control
var grid = document.getElementById("<%= gvStudent.ClientID %>");
//variable to contain the cell of the grid
var cell;
if (grid.rows.length > 0)
{
//loop starts from 1. rows[0] points to the header.
for (i=1; i<grid.rows.length; i++)
{
//get the reference of first column
cell = grid.rows[i].cells[0];
//loop according to the number of childNodes in the cell
for (j=0; j<cell.childNodes.length; j++)
{
//if childNode type is CheckBox
if (cell.childNodes[j].type == "checkbox")
{
//assign the status of the Select All checkbox to the cell checkbox within the grid
cell.childNodes[j].checked = document.getElementById(id).checked;
}
}
}
}
}
</script>
<title>Home</title>
</head>
<body>
<form id="frmHome" runat="server">
<table>
<tr>
<td style="width:15%" rowspan="3" valign="middle">
&nbsp;
2024-03-25 12:09:20 -04:00
<asp:Button runat="server" ID="btnNew" Text="Create Student" OnClick="btnNew_OnClick"/>
2024-03-20 14:09:49 -04:00
</td>
<td colspan="2" style="height: 20px; width: 538px;">
<asp:Label ID="Label1" runat="server" Text="Search criteria" Font-Bold="True" Font-Size="Medium"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2" style="width: 538px">
<asp:Panel ID="pnlSearch" runat="server" Width="100%">
<table border="1" cellpadding="1" style="width: 100%; border-top-style: ridge; border-right-style: ridge; border-left-style: ridge; border-bottom-style: ridge;">
<tr>
<td style="width: 25%; height: 26px;">
Student ID:
</td>
<td style="border-style: ridge;" class="auto-style1">
<asp:TextBox ID="txtStudentID" runat="server" MaxLength="6"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 25%">
First Name:
</td>
<td style="border-style: ridge;" class="auto-style2">
<asp:TextBox ID="txtFName" runat="server" Width="80%"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 25%">
Last Name:
</td>
<td style="border-style: ridge;" class="auto-style2">
<asp:TextBox ID="txtLName" runat="server" Width="80%"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr >
<td colspan="2" align="center" style="width: 700px">
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"/>
2024-03-25 12:09:20 -04:00
<asp:GridView AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" PageSize="10" CssClass="GridView" ID="gvStudent" OnSelectedIndexChanged="grdStudent_SelectedIndexChanged" runat="server" Width="100%">
2024-03-20 14:09:49 -04:00
<PagerSettings Mode="NextPreviousFirstLast" FirstPageText="Go To First Page" LastPageText="Go To Last Page" Position="Top" />
<Columns>
<asp:TemplateField HeaderText="Student ID">
<HeaderTemplate>
<asp:CheckBox ID="cbSelectAll" runat="server"/>
&nbsp;
<asp:LinkButton ID="lbtnDelete" runat="server" OnCommand="Delete_Click"
CommandName="lbtnDelete" CommandArgument='<%#Eval("Student_ID") %>'>
Delete
</asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkStudentID" runat="server" AutoPostBack="false"/>
<asp:Label ID="hidStudentID" runat="server" Text='<%#Eval("Student_ID") %>' Visible="false"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FNAME" HeaderText="First Name" SortExpression="fname"/>
<asp:BoundField DataField="LNAME" HeaderText="Last Name" SortExpression="lname"/>
<asp:BoundField HeaderText="Cities" DataField="CITY" SortExpression="city"/>
<asp:BoundField DataField="CELL_PHONE" HeaderText="Phone" SortExpression="CELL_PHONE"/>
<asp:HyperLinkField DataNavigateUrlFields="Student_ID"
DataNavigateUrlFormatString="Display.aspx?ID={0} &type=view"
HeaderText="View" Text="View" runat="server" Target="_blank">
<HeaderStyle HorizontalAlign="Left"/>
</asp:HyperLinkField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:LinkButton ID="lbtnEdit" runat="server"
OnCommand="lbtnEdit_Click" CommandName="lbtnEdit"
CommandArgument='<% # Eval("Student_IDs") %>'>
Edit
</asp:LinkButton>&nbsp;&nbsp;
<asp:ImageButton ID="imgDelete" runat="server" CommandArgument='<% # Eval("Student_ID") %>' OnCommand="Delete_Click"
CommandName="lbtnDelete" ImageUrl="~/images/delete.jpg" Height="30" Width="30"/>||
<asp:ImageButton ID="imgEdit" runat="server" CommandArgument='<% # Eval("Student_ID") %>' OnCommand="lbtnEdit_Click"
CommandName="lbtnEdit" ImageUrl="~/images/edit.jpg" Height="30" Width="30"/>
</ItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" CommandArgument='<% # Eval("Student_ID") %>' OnCommand="Delete_Click"
CommandName="lbtnDelete" ImageUrl="~/images/delete.jpg" Height="30" Width="30"/>||
<asp:ImageButton ID="imgEdit" runat="server" CommandArgument='<% # Eval("Student_ID") %>' OnCommand="lbtnEdit_Click"
CommandName="lbtnEdit" ImageUrl="~/images/edit.jpg" Height="30" Width="30"/>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left"/>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No Records Found Matching Your Search!
</EmptyDataTemplate>
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="3" style="width: 100%">
&nbsp;
</td>
</tr>
</table>
</form>
</body>
</html>