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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:29:19+00:00 2026-06-06T23:29:19+00:00

We are developing a project in ASP.NET/C# which is a not a very large

  • 0

We are developing a project in ASP.NET/C# which is a not a very large project but a sizeable one. Currently we have developed few pages. I am talking from point of view of a single page right now.The approach is followed for every pages that has been developed so far.

In the code behind of my page we use Linq To SQL queries directly. The insert operation is done , queries to fill dropdownlists and other database related operations are used in code behind itself.

We use functions though.The same goes for other pages as well.

My question is should I include them in class files and then create objects and call appropriate methods to do my stuff?

If yes, should we create a single class or create one class per page. Is this called creating Data Access Layer.

Can anyone help me suggest a proper way to do this?

Is this approach a good programming practice.

This is a simple function that we are using in our code behind

public void AccountTypeFill()
        {
            //Get the types of Account ie Entity and individual
            var acc = from type in dt.mem_types
                       select type.CustCategory;
            if (acc != null)
            {
                NewCustomerddlAccountType.DataSource = acc.Distinct().ToList();
                NewCustomerddlAccountType.DataBind();  
            }
        }

Can anyone point a simple example referring to this query?

I hope my question makes sense.
Any suggestions are welcome.

  • 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-06T23:29:20+00:00Added an answer on June 6, 2026 at 11:29 pm

    Don’t hard-code in the code-behind. Use Classes and it is not a matter of one class for each page.

    These links will help:

    Designing A Data Access Layer in LINQ to SQL

    Can LINQ to SQL generated objects be decoupled?

    Where to put method code which is called on click of a button?

    LINQ to SQL and the repository pattern

    Decoupling Business Logic Layer from the User Interface Layer using C#

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

Sidebar

Related Questions

Currently in the early stages of developing a very large project using ASP.Net MVC.
I have a project (Web Application) which I have been developing in C#/ASP.NET, and
I am developing a asp.net project and I dont have very long web.config file
i m developing my project in asp.net MVC-3. In these in one module i
i have a problem i am developing an asp.net mvc project. Website is in
I'm developing an ASP.Net project. I have an <asp:Table> control on my page, to
I am currently developing an ASP.NET MVC project. I want to implement an ActionFilter,
I'm developing a small project in ASP.NET MVC to manage photos, but I don't
Recently converted my ASP.NET project from 1.1 to 3.5. Hooray! Currently developing a form
I used PHP years ago but have since been developing in C#/VB.Net. In ASP.Net

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.