hi please help me with a filter on view
-
hi have a table with email history that when i click on each subject it call external link. my problem is how can i filter my record per Id, because on same table they are a more than same username but with different value cells. on
@Html.Raw(rec.MailBodyHtml)
on debug mode i see 5 record for username that's fine but i want filter with primary key of the table on sql. note the primary key on table have no relation with other id . this is my code on view side :
[Imprimer](#) @foreach (var rec in Model) { @Html.Raw(rec.MailBodyHtml) } @{ //foreach (var rec in Model.ReceivedAlerts.OrderBy(c => c.Date)) //foreach (var rec in Model.ReceivedAlerts.Where(t => t.Email != null)) foreach (var rec in Model) {
Date
Sujet
Nombres
Nom
Email
Type
@rec.Date.ToString("dd-MM-yy
-
hi have a table with email history that when i click on each subject it call external link. my problem is how can i filter my record per Id, because on same table they are a more than same username but with different value cells. on
@Html.Raw(rec.MailBodyHtml)
on debug mode i see 5 record for username that's fine but i want filter with primary key of the table on sql. note the primary key on table have no relation with other id . this is my code on view side :
[Imprimer](#) @foreach (var rec in Model) { @Html.Raw(rec.MailBodyHtml) } @{ //foreach (var rec in Model.ReceivedAlerts.OrderBy(c => c.Date)) //foreach (var rec in Model.ReceivedAlerts.Where(t => t.Email != null)) foreach (var rec in Model) {
Date
Sujet
Nombres
Nom
Email
Type
@rec.Date.ToString("dd-MM-yy
Goa call girls
Chennai call girls
Chandigarh call girls
Dehradun call girls
Faridabad call girls
Jaipur call girls
Shimla call girls
Mumbai call girls
Kolkata call girls
Lucknow call girls
Noida call girls
Hyderabad call girls
Delhi call girls
Ahmedabad call girls
Zirakpur call girls
Surat call girls
Pune call girls
Mohali call girls
Bangalore call girls -
hi have a table with email history that when i click on each subject it call external link. my problem is how can i filter my record per Id, because on same table they are a more than same username but with different value cells. on
@Html.Raw(rec.MailBodyHtml)
on debug mode i see 5 record for username that's fine but i want filter with primary key of the table on sql. note the primary key on table have no relation with other id . this is my code on view side :
[Imprimer](#) @foreach (var rec in Model) { @Html.Raw(rec.MailBodyHtml) } @{ //foreach (var rec in Model.ReceivedAlerts.OrderBy(c => c.Date)) //foreach (var rec in Model.ReceivedAlerts.Where(t => t.Email != null)) foreach (var rec in Model) {
Date
Sujet
Nombres
Nom
Email
Type
@rec.Date.ToString("dd-MM-yy
Chrayet Mahdi wrote:
how can i filter my record per Id,
That makes no sense. A record id is unique. You never filter 'on' it. You can either query for it directly or use it, perhaps in a collection to pull records that match each id in that collection. I can't figure out what you want to do. Instead of throwing code I suggest that you figure out how to ask the question in english and ask for an algorithm (steps) to solve it then write code from that. For example ... 1. You want to present a list of user names. 2. Then a user picks a name. 3. That name represents a set/collection of emails in the database. So then how to get from 1 to 3?
-
hi have a table with email history that when i click on each subject it call external link. my problem is how can i filter my record per Id, because on same table they are a more than same username but with different value cells. on
@Html.Raw(rec.MailBodyHtml)
on debug mode i see 5 record for username that's fine but i want filter with primary key of the table on sql. note the primary key on table have no relation with other id . this is my code on view side :
[Imprimer](#) @foreach (var rec in Model) { @Html.Raw(rec.MailBodyHtml) } @{ //foreach (var rec in Model.ReceivedAlerts.OrderBy(c => c.Date)) //foreach (var rec in Model.ReceivedAlerts.Where(t => t.Email != null)) foreach (var rec in Model) {
Date
Sujet
Nombres
Nom
Email
Type
@rec.Date.ToString("dd-MM-yy
Maybe a little late. You want to sort your records by ID, not filter them. To sort the records by Id, you can use 'LINQ' to sort the 'Model' before iterating through it in your foreach loop, assuming Id is a property of the objects in your 'Model' - Sorting Operators: OrderBy & OrderByDescending[^] Your code will look something like -
@foreach (var rec in Model.OrderBy(r => r.Id))
{@rec.Date.ToString("dd-MM-yyyy hh:ss") [@rec.MailSubject](@Url.Action\() @rec.Nb @rec.NomAlerte @rec.Email @rec.TypeAlerte
}