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 8462571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:12:03+00:00 2026-06-10T14:12:03+00:00

Please help as i am new in c# i have facing the below error

  • 0

Please help as i am new in c#

i have facing the below error

“DataBinding: ‘Sherserve.CustomTypeLayer.EmployeeLeave’ does not contain a property with the name ’empId’ “

here is my code :

protected void Button1_Click(object sender, EventArgs e)
{
    LMSManager leavestatus = new LMSManager();
    int emplid = Convert.ToInt32(Session["EmployeeID"]);
    List<EmployeeLeave> leaverecord = leavestatus.GetLeaveRecord(emplid);

    GridView1.DataSource = leaverecord;
    GridView1.DataBind();
}

here is EmployeeLeave :

public class EmployeeLeave
{
    public LeaveReason LeaveType { get; set; }
    public int EmployeeId { get; set; }
    public DateTime DateFrom { get; set; }
    public DateTime DateTo { get; set; }
    public string Reason { get; set; }
}

here is aspx :

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="True"
  PageSize="3" OnPageIndexChanging="GridView1_PageIndexchanging" CellPadding="4"
  ForeColor="#333333" Height="16px" 
  Style="margin-bottom: 0px; margin-right: 0px;">
  <%-- DataSourceID="SqlDataSource1"--%>
    <AlternatingRowStyle BackColor="White" />
    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <SortedAscendingCellStyle BackColor="#FDF5AC" />
    <SortedAscendingHeaderStyle BackColor="#4D0000" />
    <SortedDescendingCellStyle BackColor="#FCF6C0" />
    <SortedDescendingHeaderStyle BackColor="#820000" />

    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblEmpId" runat="server" Text='<%#Eval("empId")%>'/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblLeaveType" runat="server" Text='<%#Eval("LeaveType") %>'/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblempid" runat="server" Text='<%#Eval("EmployeeId") %>'/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblDateFrm" runat="server" Text='<%#Eval("DateFrom") %>'/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblDateTo" runat="server" Text='<%#Eval("DateTo") %>'/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Label ID="lblRsn" runat="server" Text='<%#Eval("Reason") %>'/>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
  • 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-06-10T14:12:05+00:00Added an answer on June 10, 2026 at 2:12 pm

    It looks like your databinding is referring to empId while the field on EmployeeLeave is actually called EmployeeId.

    Try changing

    <ItemTemplate>
        <asp:Label ID="lblEmpId" runat="server" Text='<%#Eval("empId")%>'></asp:Label>
    </ItemTemplate>
    

    to

    <ItemTemplate>
        <asp:Label ID="lblEmpId" runat="server" Text='<%#Eval("EmployeeId")%>'></asp:Label>
    </ItemTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am new in php i have a problem in my php code.please help
I am quite new to programming, i have a question please help me. (
I am new to Java+Maven and PlayN. Please help me regarding following error. Getting
I'm new to RMI technology and facing below issue. We have Multiple Devices of
I am new to hibernate. Please help me in understanding this. I have Department
I am very new to json, please help me out! Suppose I have the
Please help me to write a trigger that adds new rows to a table.
please help me, i'm very new in objective-c i've got 2 simplest classes (bellow
I am new in CSS so please help me in this problem. I hope
I'm relatively new to coding so please help me out here. The code will

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.