473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Where should I place this code?

Hello,

On my ASP.NET MVC project I create ViewData classes to pass
information from the controller to the view.

Where should I place the view data classes? Since they kind of reshape
the classes created by the LINQ to SQL I added them do the models.

Not sure if this is the best place to add these classes or even the
best way to do this.

Here is an example:

namespace MyApp.Models
{
public class FilePaper
{
public File File { get; set; }
public List Tags { get; set; }
}
public class FileViewData
{
public PagedList FilesPapers { get; set; }
public FilePaper FilePaper { get; set; }
}
}

In this moment I am using this on the FileController but I suppose
this could be used somewhere else ...

Anyway, just trying to be sure about this since I am still not very
confortable with MVC.

Thanks,

Miguel
Jul 14 '08 #1
1 1297
the convention for MVC is to define viewdata in the models folder. you
probably should make each class it it's own file.
-- bruce (sqlwork.com)
"shapper" wrote:
Hello,

On my ASP.NET MVC project I create ViewData classes to pass
information from the controller to the view.

Where should I place the view data classes? Since they kind of reshape
the classes created by the LINQ to SQL I added them do the models.

Not sure if this is the best place to add these classes or even the
best way to do this.

Here is an example:

namespace MyApp.Models
{
public class FilePaper
{
public File File { get; set; }
public List Tags { get; set; }
}
public class FileViewData
{
public PagedList FilesPapers { get; set; }
public FilePaper FilePaper { get; set; }
}
}

In this moment I am using this on the FileController but I suppose
this could be used somewhere else ...

Anyway, just trying to be sure about this since I am still not very
confortable with MVC.

Thanks,

Miguel
Jul 14 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Roberto Castro | last post by:
Hello! I have been assigned for the first time an adp Access project and so far I have managed to make the changes needed for some requirements. However, I am struggling to find the place where...
10
by: vwd2005eeb | last post by:
Visual Web Developer 2005 Express Edition Beta I did Build | Build Web site, where are the DLLs? I was expecting to see maybe one dll for each Web page in a directory (maybe still "bin") under...
7
by: Alan Silver | last post by:
Hello, I am just looking at VWD and seeing what needs doing to take an existing site I've written by hand and importing it into VWD. I've already discovered that I need to rename my code-behind...
4
by: Michael | last post by:
Hi When I New a web site, the default coding model is code-separation. I can uncheck the "place code in separate file" checkbox when I add a new WebForm, and VS2005 will remember this setting. ...
13
by: Viken Karaguesian | last post by:
Hello everyone, Can anyone recommend a good online site to learn PHP? The W3Schools website is quite lacking - leaves much to be desired. I'm sure there are many places, but which ones are good?...
10
by: Paul Cheetham | last post by:
Hi, I am developing an application that needs to store some machine-specific settings. The application is going to be published on the network in order to keep the clients on the latest version....
15
by: amit.man | last post by:
Hi, i have newbie qestion, when i write #include <somthing.h> the precompiler subtitue that line with the lines from "somthing.h" header file. when, where and how the compiler insert the...
2
by: Mr. T | last post by:
Hi, i have a master page, and then my aspx page that uses that master page. Now in my aspx i want to use a LinkButton to sort data on my page. My question is where do i put the sub the...
41
by: Miroslaw Makowiecki | last post by:
Where can I download Comeau compiler as a trial version? Thanks in advice.
2
by: Reggie | last post by:
Hi and TIA! I have a class file located in my root directory with all me web pages. I call/use the class and it works fine. I have no imports statements aspx or codebehind. My question is why? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.