π¨π» Helping Kai Build His First Front-End App
We used C# with ASP.NET Web Forms (ASPX) to create login and home pages, and then expanded into pages for courses, students, lectures, grades, and even a small library system.
π Step 1: Building the Login Page
Before you can get into the app, you need a secure login. We reused our earlier hashed + salted password system but wrapped it with an ASPX login form.
<asp:TextBox ID="txtUsername" runat="server" Placeholder="Username"></asp:TextBox>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Placeholder="Password"></asp:TextBox>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
<asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
And in the code-behind (Login.aspx.cs):
protected void btnLogin_Click(object sender, EventArgs e)
{
if (AuthService.ValidateLogin(txtUsername.Text, txtPassword.Text))
{
Response.Redirect("Home.aspx");
}
else
{
lblMessage.Text = "Invalid username or password.";
}
}
π Step 2: Creating the Home Page
Once Kai got his first successful login, we built a Home.aspx page. This is like a dashboard, with links to different modules.
<ul>
<li><a href="Courses.aspx">π Courses</a></li>
<li><a href="Students.aspx">π Students</a></li>
<li><a href="Lectures.aspx">π Lectures</a></li>
<li><a href="Grades.aspx">π Grades</a></li>
<li><a href="Library.aspx">π Library</a></li>
</ul>
Kai loved the idea of a "hub" where he can branch into each section.
π Step 3: Adding Content Pages
Over the last few weeks, we’ve been building out the actual modules:
- π Courses.aspx → lets him add, edit, and delete courses.
- π Students.aspx → simple form to register new students.
- π Lectures.aspx → keep track of lecture schedules.
- π Grades.aspx → teachers can enter student grades.
- π Library.aspx → a mini system for borrowing and returning books.
For example, here’s a snippet from the Students.aspx form:
<asp:TextBox ID="txtStudentName" runat="server" Placeholder="Student Name"></asp:TextBox>
<asp:TextBox ID="txtEmail" runat="server" Placeholder="Email"></asp:TextBox>
<asp:Button ID="btnAddStudent" runat="server" Text="Add Student" OnClick="btnAddStudent_Click" />
And the backend in C#:
protected void btnAddStudent_Click(object sender, EventArgs e)
{
StudentService.AddStudent(txtStudentName.Text, txtEmail.Text);
lblMessage.Text = "Student added successfully!";
}
π§ Step 4: What Kai Learned
Throughout this, Kai got to see how front end and back end connect
:- π» ASPX pages handle input and display.
- ⚙️ C# code-behind calls services or stored procedures.
- π️ SQL database stores the secure, validated data.
He also started to see why security matters at every step, not just in the database.
✨ Final Thoughts
It’s been a rewarding few weeks — Kai’s app now has real screens, real data, and a proper login system. Next, we’ll polish the design and maybe add search and reporting features.
Kai: “Seeing my login work for the first time made it feel real. It’s not just code anymore, it’s my own app!”
Thanks for reading!
— Terry Jago




Comments
Post a Comment