I have a grid that is named grdUserActivity. I'm not sure what the error means.
The name 'grdUserActivity' does not exist in the current context
C#
public partial class frmViewPersonnel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// Declares the DataSet
dsUserActivity myDataSet = new dsUserActivity();
// Fill the dataset with what is returned from the function
myDataSet = clsDataLayer.GetUserActivity(Server.MapPath("PayrollSystem_DB.mdb"));
// Sets the DataGrid to the DataSource based on the table
grdUserActivity.DataSource = myDataSet.Tables["tblUserActivity"];
// Binds the DataGrid
grdUserActivity.DataBind();
}
}
}
.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmPersonnel.aspx.cs" Inherits="frmPersonnel" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
</div>
<asp:Panel ID="Panel1" runat="server" Height="250px" HorizontalAlign="Left"
Width="300px">
<asp:Label ID="Label1" runat="server" Text="First Name:" Width="80px"></asp:Label>
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Last Name:" Width="80px"></asp:Label>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="Pay Rate:" Width="80px"></asp:Label>
<asp:TextBox ID="txtPayRate" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label4" runat="server" Text="Start Date:" Width="80px"></asp:Label>
<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label5" runat="server" Text="End Date:" Width="80px"></asp:Label>
<asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnSubmit" runat="server"
PostBackUrl="~/frmPersonnalVerified.aspx" Text="Submit"
onclick="btnSubmit_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
<br />
<asp:Label ID="lblError" runat="server"></asp:Label>
</asp:Panel>
</form>