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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:04:30+00:00 2026-05-24T08:04:30+00:00

How can i show Data from a class into a gridview? MY Class is:

  • 0

How can i show Data from a class into a gridview?
MY Class is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


public class EmployeeDetails
{
    private int employeeID;

    public int EmployeeID
    {
        get
        {
            return employeeID;
        }
        set
        {
            employeeID = value;
        }
    }

    private string firstName;

    public string FirstName
    {
        get
        {
            return firstName;
        }
        set
        {
            firstName = value;
        }
    }

    private string lastName;

    public string LastName
    {
        get
        {
            return lastName;
        }
        set
        {
            lastName = value;
        }
    }

    private string titleOfCourtesy;

    public string TitleOfCourtesy
    {
        get
        {
            return titleOfCourtesy;
        }
        set
        {
            titleOfCourtesy = value;
        }
    }

    public EmployeeDetails(int employeeID, string firstName, string lastName, string titleOfCourtesy)
    {
        EmployeeID = employeeID;
        FirstName = firstName;
        LastName = lastName;
        TitleOfCourtesy = titleOfCourtesy;
    }
}

I`ve done this:

 protected void Page_Load(object sender, EventArgs e)
    {
        int id = 15;
        string f_name = "asd";
        string l_name = "asd";
        string title = "asd";

        EmployeeDetails emp = new EmployeeDetails(id,f_name,l_name,title);

        emp.EmployeeID = id;
        emp.FirstName = f_name;
        emp.LastName = l_name;
        emp.TitleOfCourtesy = title;
}
  • 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-24T08:04:30+00:00Added an answer on May 24, 2026 at 8:04 am

    A GridView is generally used to display multiple objects/rows. To get it to display your class you need to make a collection containing your class, such as a List<EmployeeDetails>. Then bind that to your gridview.

    You could use another control more suited to displaying a single object such as a DetailsView.

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

Sidebar

Related Questions

I'm using a UITableView to show some data from an array. This array can
How can i export my data from SQL server 2008 into Excel 2010 or
Is there an IDE/Tool/script/something that can show call hierarchy and/or data flow in Scala+Java
Can anyone show me a way of converting SQL Server data-types (varchar for example)
I'm looking for a good guide into the right method of using Linq to
Is it possible using Linq to create a group where items fall into more
I'm trying to figure out how to capture data from a form using EditText
I have a web form used for importing data from a CSV file. It
I can get data into my TabControl but the headers have frames around them
I have a Silverlight Windows Phone 7 app that pulls data from a public

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.