Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 545265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:44:35+00:00 2026-05-13T10:44:35+00:00

I have two files named as TimeSheet.aspx.cs and TimSheet.aspx ,code of the file are

  • 0

I have two files named as TimeSheet.aspx.cs and TimSheet.aspx ,code of the file are given below for your reference.

when i build the application im getting error “The name ‘GridView1’ does not exist in the current context” even thought i have a control with the id GridView1 and i have added the runat=”server” as well.

Im not able to figure out what is causing this issue.Can any one figure whats happen here.

Thanks & Regards,

=======================================
TimeSheet.aspx.cs 
=======================================
#region Using directives
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSMS.Web.UI;
#endregion

public partial class TimeSheets: Page
{   
    protected void Page_Load(object sender, EventArgs e)
    {

        FormUtil.RedirectAfterUpdate(GridView1, "TimeSheets.aspx?page={0}");
        FormUtil.SetPageIndex(GridView1, "page");
        FormUtil.SetDefaultButton((Button)GridViewSearchPanel1.FindControl("cmdSearch"));
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string urlParams = string.Format("TimeSheetId={0}", GridView1.SelectedDataKey.Values[0]);
        Response.Redirect("TimeSheetsEdit.aspx?" + urlParams, true);
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) {


    }
}
=======================================================
TimeSheet.aspx
=======================================================
<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true"  CodeFile="TimeSheets.aspx.cs" Inherits="TimeSheets" Title="TimeSheets List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">Time Sheets List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1" PersistenceMethod="Session" />
        <br />
        <data:EntityGridView ID="GridView1" runat="server"          
                AutoGenerateColumns="False"                 
                OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                DataSourceID="TimeSheetsDataSource"
                DataKeyNames="TimeSheetId"
                AllowMultiColumnSorting="false"
                DefaultSortColumnName="" 
                DefaultSortDirection="Ascending"    
                ExcelExportFileName="Export_TimeSheets.xls" onrowcommand="GridView1_RowCommand"         
            >
            <Columns>
                <asp:CommandField ShowSelectButton="True" ShowEditButton="True" />              
                <asp:BoundField DataField="TimeSheetId" HeaderText="Time Sheet Id" SortExpression="[TimeSheetID]" ReadOnly="True" />
                <asp:BoundField DataField="TimeSheetTitle" HeaderText="Time Sheet Title" SortExpression="[TimeSheetTitle]"  />
                <asp:BoundField DataField="StartDate" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Start Date" SortExpression="[StartDate]"  />
                <asp:BoundField DataField="EndDate" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="End Date" SortExpression="[EndDate]"  />
                <asp:BoundField DataField="DateOfCreation" DataFormatString="{0:d}" HtmlEncode="False" HeaderText="Date Of Creation" SortExpression="[DateOfCreation]"  />
                <data:BoundRadioButtonField DataField="Locked" HeaderText="Locked" SortExpression="[Locked]"  />
                <asp:BoundField DataField="ReviewedBy" HeaderText="Reviewed By" SortExpression="[ReviewedBy]"  />
                <data:HyperLinkField HeaderText="Employee Id" DataNavigateUrlFormatString="EmployeesEdit.aspx?EmployeeId={0}" DataNavigateUrlFields="EmployeeId" DataContainer="EmployeeIdSource" DataTextField="LastName" />

            </Columns>
            <EmptyDataTemplate>
                <b>No TimeSheets Found!</b>
            </EmptyDataTemplate>
        </data:EntityGridView>
        <asp:GridView ID="GridView2" runat="server">
    </asp:GridView>
        <br />
        <asp:Button runat="server" ID="btnTimeSheets" OnClientClick="javascript:location.href='TimeSheetsEdit.aspx'; return false;" Text="Add New"></asp:Button>
        <data:TimeSheetsDataSource ID="TimeSheetsDataSource" runat="server"
            SelectMethod="GetPaged"
            EnablePaging="True"
            EnableSorting="True"
            EnableDeepLoad="True"
            >
            <DeepLoadProperties Method="IncludeChildren" Recursive="False">
                <Types>
                    <data:TimeSheetsProperty Name="Employees"/> 
                    <%--<data:TimeSheetsProperty Name="TimeSheetDetailsCollection" />--%>
                </Types>
            </DeepLoadProperties>
            <Parameters>
                <data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
                <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
                <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex" Type="Int32" />
                <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize" Type="Int32" />
                <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
            </Parameters>
        </data:TimeSheetsDataSource>

</asp:Content>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:44:36+00:00Added an answer on May 13, 2026 at 10:44 am

    Problem can be that GridView1 is not automatically added in designer.cs file. If that is case add it in designer manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file named file with three lines: line one line two line
I have two files A - nodes_to_delete and B - nodes_to_keep . Each file
I have two header files named string.h in different libraries, they are conflicted with
I have two source files, one named main.cpp (where the namespace M is defined)
The directory 'C:\temp' has two files named 'GZ96A7005.tif' and 'GZ96A7005001.tif'. They have different length
I've created a dotnetnuke. I have two files named index.ascx and index.html that as
I have two files once is named as test.cpp and another as ani.cpp. test.cpp
I have a file named 'mainZip.zip' ' This file ( 'mainZip.zip' ') contains two
Let's say I have an application with two files. Console.cs and Business.cs Console.cs has
I have a single CherryPy application serving two websites, each having their static files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.