TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
varun sharma
NA
150
2.7k
Getting error while sending data from controller to view.
Jan 12 2020 12:59 AM
Column cndID is present in the model class and I get the data in the "result riew" but while sending data from controller to view is not working, getting below error but while using return View(db.cndPersonalDetails.ToList()); its working fine.
Kindly suggest how to resolve this issue.
Message "error CS1061: 'IQueryable<cndPersonalDetail>' does not contain a definition for 'cndID' and no extension method 'cndID' accepting a first argument of type 'IQueryable<cndPersonalDetail>' could be found (are you missing a using directive or an assembly reference?)" string
var userid = Session["UserName"].ToString();
var id = db.Registrations.Where(m => m.userID == userid).Select(m => m.id).FirstOrDefault();
var result = db.cndPersonalDetails.Join(db.registrationDetails,
a => a.id, b => b.createdFor, (a, b) => new { a, b }).ToList().
Join(db.Registrations, r => r.b.createdBy, reg => reg.id, (r, reg) => new { r, reg }).ToList()
.Where(m => m.r.b.createdBy == id).Select(m => new { m.r.a.cndID, m.r.a.createdBy, m.r.a.emailID, m.r.a.experienceMonth, m.r.a.experienceYear, m.r.a.isActive, m.r.a.Name, m.r.a.Number, m.r.a.Resume});
return View(result.ToList());
View
@model IQueryable<hrProject.Models.cndPersonalDetail>
namespace hrProject.Models
{
using System;
using System.Collections.Generic;
public partial class cndPersonalDetail
{
public int id { get; set; }
public string cndID { get; set; }
public string Name { get; set; }
public int Number { get; set; }
public string emailID { get; set; }
public int experienceYear { get; set; }
public int experienceMonth { get; set; }
public byte[] Resume { get; set; }
public string createdBy { get; set; }
public bool isActive { get; set; }
}
}
Below is the result view
+ [0] { cndID = "2", createdBy = "
[email protected]
", emailID = "Varun@Varun", experienceMonth = 5, experienceYear = 4, isActive = true, Name = "Varun", Number = 99538, Resume = null } <Anonymous Type>
+ [1] { cndID = "3", createdBy = "
[email protected]
", emailID = "varun", experienceMonth = 3, experienceYear = 5, isActive = true, Name = "Varun1", Number = 255, Resume = null } <Anonymous Type>
+ [2] { cndID = "4", createdBy = "
[email protected]
", emailID = "gjyg", experienceMonth = 85, experienceYear = 87, isActive = true, Name = "Varun2", Number = 21516, Resume = null } <Anonymous Type>
Reply
Answers (
1
)
Need Return Value From Cs class File to aspx.cs
Add XElement to another XElement in specific location