Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HTML/ .ASPX Clicking this bu will allow the us add a new stude will take you to

ID: 3829202 • Letter: H

Question

HTML/ .ASPX

Clicking this bu will allow the us add a new stude will take you to figure 4.2. Sce My Students 4 for details ng this First Name will take No records found main Last Name Student Id School Name This is a table g when input fro figure 4.2. Initi Ok "No records Fe nitially, there are Figure 4.1 the messa No Records Found". no students. So you must how Gray out this button or disable click My Students activity when New Student Information entering a new student Student First Name Regular Text Boxes Student Last Name with proper icons as ng this shown. Student led will take re 4.1 ool Name Clicking "Add to Cancel Add to List List''. See details mex Figure 4.2

Explanation / Answer

Default.aspx.cs


using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
OleDbConnection conn;
OleDbCommand cmd;
OleDbDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:student.accdb; Persist Security Info = False;");
conn.Open();
}
protected void Button2_Click(object sender, EventArgs e)
{
if (GridView1.Rows.Count == 0)
{
Label2.Text = "No Records Found";
}
Label2.Text = "Not Empty";
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx");
}
}


Default2.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
public partial class Default2 : System.Web.UI.Page
{
OleDbConnection conn;
OleDbCommand cmd;
// OleDbDataReader dr;
  
protected void Page_Load(object sender, EventArgs e)
{
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:student.accdb; Persist Security Info = False;");
conn.Open();
  
}
protected void Button5_Click(object sender, EventArgs e)
{
string fn, ln, stdid, schnm;
fn = TextBox1.Text;
ln = TextBox2.Text;
stdid = TextBox3.Text;
schnm = TextBox4.Text;
cmd = new OleDbCommand("insert into student values('"+fn+ "','" + ln + "','" + stdid + "','" + schnm + "')", conn);
cmd.ExecuteNonQuery();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Label3.Text = "Record Inserted Successfully";
Response.Redirect("Default3.aspx");
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
}
Default3.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Unnamed1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect(Request.RawUrl);
}
}