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
Asp.Net Hein
NA
266
166.4k
Help me with the best and true solution
Jul 2 2015 9:34 PM
var myList = from x in eb.trainings
where (ddlcourse.SelectedItem.Text == "-Select one-" || x.course.CourseCode == ddlcourse.SelectedValue.ToString())
&& (ddlcompany.SelectedItem.Text == "-Select one-" || x.company.Company_Name == ddlcompany.SelectedValue.ToString())
&& (ddlgender.SelectedItem.Text == "-Select one-" || x.member.Gender == ddlgender.SelectedValue.ToString())
&& (ddlnationality.SelectedItem.Text == "-Select one-" || x.member.Nationality == ddlnationality.SelectedValue.ToString())
&& (ddlrace.SelectedItem.Text == "-Select one-" || x.member.Race == ddlrace.SelectedValue.ToString())
select new trainingdetails { idNumber = x.IDNo, name = x.member.Name, assessmentdate = x.AssessmentDate, submissiontype = x.SubmissionType, result = x.Result};
var q = from h in myList
group h by new { h.idNumber, h.name, h.assessmentdate, h.submissiontype, h.result } into k
where k.Where(z => z.idNumber == k.Key.idNumber).Count() <=
a
select new trainingdetails { idNumber = k.Key.idNumber, name = k.Key.name, assessmentdate = k.Key.assessmentdate, submissiontype = k.Key.submissiontype, result = k.Key.result };
if (q.Any())
{
grvbind.DataSource = q.ToList();
grvbind.DataBind();
grvbind.RowStyle.Wrap = false;
grvbind.Visible = true;
lblgriderror.Text = "";
btnexp2exl.Visible = true;
btnexport.Visible = true;
btnprint.Visible = true;
btnexp2exl.Enabled = true;
btnexport.Enabled = true;
btnprint.Enabled = true;
}
else
{
grvbind.Visible = true;
lblgriderror.Text = "No Record Found!!!";
btnexp2exl.Visible = false;
btnexport.Visible = false;
btnprint.Visible = false;
}
In this code, if the value
'a'
is more than 1, the data do not bind to the gridview.The data in the database is many amount=>2,3,4,5,......
If you have any idea to my code to get solution, please help me.
Thanks a lot for viewing my question.
Reply
Answers (
2
)
which method is the best one to develop MVC application
GridView - Get Column Header + Button Link- RowCommand