Tagged Questions
0
votes
1answer
438 views
MVC2.NET pass object from viewmodel to view and access it
When working with Viewmodels from linq to sql I have an architectural problem.
When you have an object from your db (let's say "person"), and you load it in your viewmodel. After this in your view, ...
0
votes
2answers
70 views
LINQ2SQL InvalidCastException
I have a website which from time to time, loses access to the database. The website still runs on the IIS, and I can hit the front page without problems.
I haven't encountered this error in ...
0
votes
2answers
83 views
asp.net mvc adding list to viewmodel
How can I add the list of PosttypeMetas below to my viewmodel?
static void Main(string[] args)
{
List<PosttypeMetas> a = new List<PosttypeMetas>();
a.Add(new ...
0
votes
1answer
78 views
An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported
when running the code i am getting the following error on insert
An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not ...
0
votes
1answer
2k views
Validate MVC 2 form using Data annotations and Linq-to-SQL, before the model binder kicks in (with DateTime)
I'm using linq to SQL and MVC2 with data annotations and I'm having some problems on validation of some types.
For example:
[DisplayName("Geplande sessies")]
[PositiefGeheelGetal(ErrorMessage = ...
1
vote
4answers
2k views
How can I create a generic UniqueValidationAttribute in C# and DataAnnotation?
I'm trying to create a UniqueAttribute using the System.ComponentModel.DataAnnotations.ValidationAttribute
I want this to be generic as in I could pass the Linq DataContext, the table name, the field ...
0
votes
2answers
819 views
Adding an extra data text field in SelectList in MVC
I am using a select list to pass text to the checkbox , What I want is to pass the 2 text fields to the checkboxlist , but Select list doesnt have any options to provide 2 or 3 data text field , I ...
3
votes
1answer
2k views
Remove Duplicate based on column value-linq
Hi
i have many to many relationship between employee and group. following linq statement
int[] GroupIDs = {6,7};
var result = from g in umGroups
join empGroup in umEmployeeGroups on g.GroupID ...
0
votes
1answer
110 views
How to map entity classes dynamically?
I have strongly typed entity class, which is used for Linq-To-Sql:
[Table(Name = "_Reference2")]
public class Customer
{
[Column(Name = "_IDRRef")]
public Binary Reference { get; set; }
...
0
votes
0answers
95 views
Sequence contains no elements even though create, delete and viewing the data works
I am having a problem being able to edit a column in a table, even though I can add and delete them quite easily. I ahve done this sort of thing before and had no problems with it, so I am stumped to ...
-3
votes
1answer
374 views
Why do I receive this error when I use LINQ in MVC?
I have a table named Student in my linq in model folder. When I run my app and I click on student tab this error appears on IE. I don’t have any idea why I see this.
Compiler Error Message:
...
0
votes
1answer
109 views
MVC2 complex type visual studio 2010 .net framework 4
i have a storeprocedure usp_getCashCommissionCustomer
defination of storedprocedure is like below
Select cw.Customercode,name,state as Province,City,Suburb,Balance As HMCommission,MBalance as
...
0
votes
1answer
82 views
MVCMiniProfiler does not show WHERE part of Linq Query
I'm using MVCMiniProfiler to profile some database queries.
For one query it fails to show the Where part of the query that I have defined in my code.
code is as follows:
MyAppDataContext.cs:
...
0
votes
0answers
106 views
Running Total ASP.NET MVC and Linq to SQL
I am using ASP.NET MVC2, SQLServer. I have 3 tables in my Database.
From tblPerson I am interested only in the PersonID field.
tblPerson[PID(pk),PName]
PID------------PName
12-------------AAA
...
0
votes
1answer
152 views
Select Records Using Linq to SQL
I need to retrieve set of 1000 records from table.. If i select 1 - 1000 in dropdowm means it will show first set of 1000 records.
Then if i select 1001 - 2000 in dropdowm means it will show second ...