MVC :: Create The Models Classes All The Time ?
Jan 7, 2011Do I need to create the Models classes all the time ?
such as
[Code]....
I would like to use the classes straightly ,that is generated by Linq to sql?
Do I need to create the Models classes all the time ?
such as
[Code]....
I would like to use the classes straightly ,that is generated by Linq to sql?
For example i need create page to display few models. Inherits property can take in only one value, as i mean.
[Code]....
I want something like:
[Code]...
i have a base controller that looks like this:
[Code]....
and a contact model that inherits from the base model.
the master page inherits form the base model,
nad the contact page inherits from the contact nodel,
but then i get an error while loading the contact page that it expects the contact model but gets the base model?
I'm about to embark upon learning how to create a web site(in fact I am about to create a website for our company) which will enable users to place an order on our system. I already have a desktop, C# WPF, application that has some of the classes I am going to require in the MVC architecture of this new website. Can anyone advise me of the best practise to reuse these classes in the website. If I was going to create a new app I would refactor the classes out of the desktop app into a class library then add this to my new app by adding an existing project (my class library) to my solution but that option does not seem to exist in creating a website?
View 7 Replieshow to create C# classes to represent one to many relationships in C#. I have a Customer and an Address table in my database. I also have a Customer class in my C# solution but how do I introduce the multiple address element? Do I have a separate Address class? Do I create a subclass in the Customer class or create a method in Customer called GetAddresses of type List which contains all of the relevant logic? In my code I need to be able to return a customer with all associated addresses and I just cannot picture the best way to achieve this using OOP.
View 9 RepliesI have a third party dll and i need to add some more functionalities (methods, constants etc..) so create a wrapper class. I have no idea about wrapper classes. what is the purpose of this and how to create in .NET for this 3rd party dll.
View 6 RepliesI have an assignment to develop a mobile application for My company's customers (around 250000). its could be download from our website or we can also provide to our customers those are visiting our branches, on their demand.Requirments:
View 5 RepliesI am used to making separate Business Object and List<> classes for my DB tables. Sometimes I just have a basic task in hand as displaying a list of year for a search box or having some values in a drop down.
Right now I am ending up with a lot of separate classes and List classes<> for these basic operations.
How can I make a single class for some basic tasks as these by using generics? I want to have single class for some methods like get current year, employee names, Department Name/Code, Title etc. I am using .NET 2.0.
Edit
After some searching, I found that I can achieve similar tasks by creating a DTO namespace.
What I don't get right now is how to create multiple classes inside my DTO class. Say 1 class for just returning 'year', One for 'Employee Name/Code' and so on inside the single DTO class.
Whenever I create a new folder in my website (VS008) and add an item (Class) it can't be seen by the other pages, even though new class is public. Only if I add the class to the app_code folder or create a bin folder for it then it could be shared from these folders however I want to create my own custom named folders for organization and keep my classes there.
View 2 Replies I am setting up my new project..We are using entity frame work 4.0..
Is there any way to generate all classes and interfaces as we create manually for 3-tier architecture...
Or do i need to generate manually...
Ex:
Itest.cs
Public Interface ITest
{
int testproperty {get;set:}
}
Test.cs
Public class Test: ITest
{
public int testproperty {get;set:}
}
where to create the BLL and DAL and all classes in it can we place them in the App_code folder as it ll convert them into DLL Files or do we have to create a new class library project for each...
View 1 RepliesI want to create two partial classes for the single aspx file. I am using vs2005 dotnet 2.0. i could not able to access method from one partial class in another partial classes.
Partial class 1 : my main aspx page
public partial class _Default : System.Web.UI.Page
{[code]...
i could not able to access meth method in partial class 2
I have 2 fields being displayed in a Gridview, StartTime, EndTime. I want to create a 'Time" column which shows the elapsed time in HH:MM format. (StartTime - EndTime) This was all generated with VS2008, table is pulled from an SQL Query.
View 1 RepliesI am trying to create an app which shows current time in 6 time zones (Sydney, S'pore, india, london, EST and CST).
I am having troubles handling DST, because DST starts and ends on different dates in different countries.
More over I want to make it configurable (add/remove cities from the list).
Currently I have added the cities in .config with their timezone differences (with respect to GMT).
[code]....
I am new to LINQ. when we drag tables we get a dbml file and designer file.
For example DataClasses1.dbml and DataClasses1.designer.cs.
Once we have them then we can start using our LINQ Queries.
In my company project I do not see this designer files and instead there are .tt files which were used as templates to greate ABC.generated.cs files. Is this same as designer class?
I am following the Nerd Dinner tutorial as I'm learning ASP.NET MVC, and I am currently on Step 3: Building the Model. One part of this section discusses how to integrate validation and business rule logic with the model classes. All this makes perfect sense. However, in the case of this source code, the author only validates one class: Dinner.
What I am wondering is, say I have multiple classes that need validation (Dinner, Guest, etc). It doesn't seem smart to me to repeatedly write these two methods in the partial class:
[code]....
This doesn't "feel" right, but I wanted to check with SO to get opinions of individuals smarter than me on this. I also tested it out, and it seems that the partial keyword on the OnValidate method is causing problems (understandably so). This doesn't seem possible to fix (but I could very well be wrong).
I don't know if this has to do with how FindControl works or how scope works. But my base class is having a hard time seeing the fields of child classes. Currently I'm planning have the derived class set a property in the base class, but there are a lot of derived classes, so that isn't a very attractive solution.
[code]....
Can I use VB and C# classes together in the same asp.net 3.5 project?
View 3 RepliesI'm curious as to what people consider better practice, between duplicating model structure in the view model and using a mapping tool to move data between the two, or aggregate the model inside the view model, i.e. have a property on the view model class that is a reference to the actual model. Which is considered a better approach in general?
View 1 RepliesI had task in web solution as button when I click on the button it create data list with some controls on data list and when I click second it create second data list and so on I want to know how can I do this?
View 1 RepliesIn our application, we have a menu control that is bound by an xml file. This xml file will be created at run time based on the role/permission configuration. Of course, It is ideal to have this xml file created and lives in the memory. When a user log off or close the browser, its xml file is killed.
menuControl.Itemsource = "newlycreated.xml";
is the syntax to bind the xml file to menu control. I don't have an idea how to do it just yet.
I am creating an application where up to 50 people could register for an event. On this part of the application, I have a dropdown menu that contains values from 1 to 50 and autopostbacks to create panels with controls inside equal to the number selected in the dropdown menu. The code for that is below:
[Code]....
The code above works pretty well for the most part (I'll explain the small glitch I found more below). But now on a button to submit the registration, I want to grab that data and insert it into a SQL database. However, when the button is clicked those fields disappear because of the postback to the server. I also noticed that if a new number is selected in the dropdown menu, all the fields clear out as well. I know I would be pretty angry if I entered 40 some names and and needed to re-enter them all again just because I chose the wrong number initially on the page. So I know the code above needs a small tweak.
This is my first time working with control generation at run time, so I am a bit stumped on how to properly set this up.
[Code]....
i need a form in such a manner that if uesr select 1 it create 1 small form/panel on web page if select 2 it will create 2 small form/panel on web page etc etc
[code]....
then i need to store record thenin database when user fill run time form/panel etc etc
I have some suitation where i want to store aspx controls in SQL Server database and retrive on aspx.cs page according to database i want to design my aspx page and also event handler to them.
Controls may be vary time to time according to suitation and aspx page changes all time according to suitaion.
For Example :
I want to display a information about Computer and Technolgy the aspx page will be display only Computer related topics like 1. Computer Name 2. Price 3. Discount
but in other case I want to display information about City Information then Display 1. City Name 2. Distance from nearest city. 3. City Map 4. About City 5. Query or book a car. extra - extra.
how to create RDLC form dynamically in run time and how to save it in asp.net c# ?
View 1 Replies