How to Search in List
up vote
0
down vote
favorite
I have a List<string>
that has some items look like this in my View:
1S61A9MAT1DKV5N74925,
1S61A9MAT1DKV5X49329,
1S61A9MAT1DKV5X49857
and i want search efter this items , but to be honest i don't know what should i tell my Controller,when its comes List<string>
i tried something like this in my controllers.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
but its not worked , i mean when i search for this item 1S61A9MAT1DKV5N74925
it can pass the value to controller ,but it cant find any results for that item i searched. and as you see in my
Contorller i have some Property which is string and there is one which is List<string>
' SerialNoInvoiceOrdrelineDeliveryCloses '
Controller:
public ActionResult test(string searchString) {
string EmailID = Session["Email"].ToString();
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
});
if (searchString !=null)
{
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
);
}
return View(v);
}
ViewModel :
public class ClosedOrders
{
public string OrderNumber { get; set; }
public string Fakturanummer { get; set; }
public List<string> SerialNoInvoiceOrdrelineDeliveryCloses { get; set; }
public string varnummer { get; set; }
}
View:
@using (Html.BeginForm("test", "Account", FormMethod.Get))
{
<p>
Find by name: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
</p>
}
//Loop Model
foreach (var item in Model)
{
<tr>
<td>
@item.Fakturanummer
</td>
<td>
@item.OrderNumber
</td>
<td> @item.varnummer</td>
<td>
@String.Join(", ", item.SerialNoInvoiceOrdrelineDeliveryCloses)
</td>
</tr>
}
c# linq
add a comment |
up vote
0
down vote
favorite
I have a List<string>
that has some items look like this in my View:
1S61A9MAT1DKV5N74925,
1S61A9MAT1DKV5X49329,
1S61A9MAT1DKV5X49857
and i want search efter this items , but to be honest i don't know what should i tell my Controller,when its comes List<string>
i tried something like this in my controllers.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
but its not worked , i mean when i search for this item 1S61A9MAT1DKV5N74925
it can pass the value to controller ,but it cant find any results for that item i searched. and as you see in my
Contorller i have some Property which is string and there is one which is List<string>
' SerialNoInvoiceOrdrelineDeliveryCloses '
Controller:
public ActionResult test(string searchString) {
string EmailID = Session["Email"].ToString();
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
});
if (searchString !=null)
{
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
);
}
return View(v);
}
ViewModel :
public class ClosedOrders
{
public string OrderNumber { get; set; }
public string Fakturanummer { get; set; }
public List<string> SerialNoInvoiceOrdrelineDeliveryCloses { get; set; }
public string varnummer { get; set; }
}
View:
@using (Html.BeginForm("test", "Account", FormMethod.Get))
{
<p>
Find by name: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
</p>
}
//Loop Model
foreach (var item in Model)
{
<tr>
<td>
@item.Fakturanummer
</td>
<td>
@item.OrderNumber
</td>
<td> @item.varnummer</td>
<td>
@String.Join(", ", item.SerialNoInvoiceOrdrelineDeliveryCloses)
</td>
</tr>
}
c# linq
1
You should not passIQueryable
to viewer. I suggest you put a.ToList()
at the end of your queries.
– roozbeh S
Nov 11 at 12:25
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a List<string>
that has some items look like this in my View:
1S61A9MAT1DKV5N74925,
1S61A9MAT1DKV5X49329,
1S61A9MAT1DKV5X49857
and i want search efter this items , but to be honest i don't know what should i tell my Controller,when its comes List<string>
i tried something like this in my controllers.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
but its not worked , i mean when i search for this item 1S61A9MAT1DKV5N74925
it can pass the value to controller ,but it cant find any results for that item i searched. and as you see in my
Contorller i have some Property which is string and there is one which is List<string>
' SerialNoInvoiceOrdrelineDeliveryCloses '
Controller:
public ActionResult test(string searchString) {
string EmailID = Session["Email"].ToString();
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
});
if (searchString !=null)
{
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
);
}
return View(v);
}
ViewModel :
public class ClosedOrders
{
public string OrderNumber { get; set; }
public string Fakturanummer { get; set; }
public List<string> SerialNoInvoiceOrdrelineDeliveryCloses { get; set; }
public string varnummer { get; set; }
}
View:
@using (Html.BeginForm("test", "Account", FormMethod.Get))
{
<p>
Find by name: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
</p>
}
//Loop Model
foreach (var item in Model)
{
<tr>
<td>
@item.Fakturanummer
</td>
<td>
@item.OrderNumber
</td>
<td> @item.varnummer</td>
<td>
@String.Join(", ", item.SerialNoInvoiceOrdrelineDeliveryCloses)
</td>
</tr>
}
c# linq
I have a List<string>
that has some items look like this in my View:
1S61A9MAT1DKV5N74925,
1S61A9MAT1DKV5X49329,
1S61A9MAT1DKV5X49857
and i want search efter this items , but to be honest i don't know what should i tell my Controller,when its comes List<string>
i tried something like this in my controllers.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
but its not worked , i mean when i search for this item 1S61A9MAT1DKV5N74925
it can pass the value to controller ,but it cant find any results for that item i searched. and as you see in my
Contorller i have some Property which is string and there is one which is List<string>
' SerialNoInvoiceOrdrelineDeliveryCloses '
Controller:
public ActionResult test(string searchString) {
string EmailID = Session["Email"].ToString();
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
});
if (searchString !=null)
{
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
);
}
return View(v);
}
ViewModel :
public class ClosedOrders
{
public string OrderNumber { get; set; }
public string Fakturanummer { get; set; }
public List<string> SerialNoInvoiceOrdrelineDeliveryCloses { get; set; }
public string varnummer { get; set; }
}
View:
@using (Html.BeginForm("test", "Account", FormMethod.Get))
{
<p>
Find by name: @Html.TextBox("SearchString")
<input type="submit" value="Search" />
</p>
}
//Loop Model
foreach (var item in Model)
{
<tr>
<td>
@item.Fakturanummer
</td>
<td>
@item.OrderNumber
</td>
<td> @item.varnummer</td>
<td>
@String.Join(", ", item.SerialNoInvoiceOrdrelineDeliveryCloses)
</td>
</tr>
}
c# linq
c# linq
edited Nov 11 at 12:05
D-Shih
24.6k61431
24.6k61431
asked Nov 11 at 11:45
The First
406
406
1
You should not passIQueryable
to viewer. I suggest you put a.ToList()
at the end of your queries.
– roozbeh S
Nov 11 at 12:25
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24
add a comment |
1
You should not passIQueryable
to viewer. I suggest you put a.ToList()
at the end of your queries.
– roozbeh S
Nov 11 at 12:25
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24
1
1
You should not pass
IQueryable
to viewer. I suggest you put a .ToList()
at the end of your queries.– roozbeh S
Nov 11 at 12:25
You should not pass
IQueryable
to viewer. I suggest you put a .ToList()
at the end of your queries.– roozbeh S
Nov 11 at 12:25
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
The problem is you are sending v
as IQueryable<ClosedOrders>
to the view. It is a bad practice to pass an IQueryable
to a view and have it run the query. First because you are sending unresolved query to the end point, Second you need to add related references to your view code. I suggest you add .ToList()
at the end of your query and send the list to the view:
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
}).ToList();
and:
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
).ToList();
add a comment |
up vote
1
down vote
The direct answer might be
// || s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString))
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly thedb.Item_Ledger_Entry
subquery.
– Henk Holterman
Nov 11 at 12:49
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
The problem is you are sending v
as IQueryable<ClosedOrders>
to the view. It is a bad practice to pass an IQueryable
to a view and have it run the query. First because you are sending unresolved query to the end point, Second you need to add related references to your view code. I suggest you add .ToList()
at the end of your query and send the list to the view:
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
}).ToList();
and:
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
).ToList();
add a comment |
up vote
0
down vote
accepted
The problem is you are sending v
as IQueryable<ClosedOrders>
to the view. It is a bad practice to pass an IQueryable
to a view and have it run the query. First because you are sending unresolved query to the end point, Second you need to add related references to your view code. I suggest you add .ToList()
at the end of your query and send the list to the view:
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
}).ToList();
and:
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
).ToList();
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The problem is you are sending v
as IQueryable<ClosedOrders>
to the view. It is a bad practice to pass an IQueryable
to a view and have it run the query. First because you are sending unresolved query to the end point, Second you need to add related references to your view code. I suggest you add .ToList()
at the end of your query and send the list to the view:
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
}).ToList();
and:
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
).ToList();
The problem is you are sending v
as IQueryable<ClosedOrders>
to the view. It is a bad practice to pass an IQueryable
to a view and have it run the query. First because you are sending unresolved query to the end point, Second you need to add related references to your view code. I suggest you add .ToList()
at the end of your query and send the list to the view:
var v = (from cbr in db.Contact_Business_Relation
join c in db.Contact on cbr.Contact_No_ equals c.Company_No_
join sih in db.Sales_Invoice_Line on sa.No_ equals sih.Document_No_
where c.E_Mail == EmailID
select new ClosedOrders
{
OrderNumber = sa.Order_No_,
Fakturanummer = sih.Document_No_,
varnummer = sih.No_,
//List<string>
SerialNoInvoiceOrdrelineDeliveryCloses = db.Item_Ledger_Entry
.Where(s => s.Item_No_ == sih.No_)
.Select(s => s.Serial_No_)
.ToList()
}).ToList();
and:
v = v.Where(s => s.OrderNumber.Contains(searchString)
|| s.Fakturanummer.Contains(searchString)
|| s.varnummer.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
).ToList();
answered Nov 11 at 20:23
roozbeh S
6961410
6961410
add a comment |
add a comment |
up vote
1
down vote
The direct answer might be
// || s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString))
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly thedb.Item_Ledger_Entry
subquery.
– Henk Holterman
Nov 11 at 12:49
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
add a comment |
up vote
1
down vote
The direct answer might be
// || s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString))
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly thedb.Item_Ledger_Entry
subquery.
– Henk Holterman
Nov 11 at 12:49
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
add a comment |
up vote
1
down vote
up vote
1
down vote
The direct answer might be
// || s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString))
The direct answer might be
// || s.SerialNoInvoiceOrdrelineDeliveryCloses.Contains(searchString)
|| s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString))
answered Nov 11 at 12:02
Henk Holterman
207k22226397
207k22226397
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly thedb.Item_Ledger_Entry
subquery.
– Henk Holterman
Nov 11 at 12:49
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
add a comment |
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly thedb.Item_Ledger_Entry
subquery.
– Henk Holterman
Nov 11 at 12:49
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
i changed to || s.SerialNoInvoiceOrdrelineDeliveryCloses.Any(x => x.Contains(searchString)) and then browser still loading and than i get this error: System.ComponentModel.Win32Exception: The waiting action was temporarily interrupted
– The First
Nov 11 at 12:10
That sounds like a completely different problem, possibly the
db.Item_Ledger_Entry
subquery.– Henk Holterman
Nov 11 at 12:49
That sounds like a completely different problem, possibly the
db.Item_Ledger_Entry
subquery.– Henk Holterman
Nov 11 at 12:49
1
1
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
Using a Browser slows you down - write Unit Test for this action and use the debugger.
– Henk Holterman
Nov 11 at 12:52
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
it was something else i was passing IQueryable to viewer and it was why i get all dis errors , anyway thanks for help .Any() and .Contains() both working :)
– The First
Nov 11 at 12:55
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248415%2fhow-to-search-in-liststring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You should not pass
IQueryable
to viewer. I suggest you put a.ToList()
at the end of your queries.– roozbeh S
Nov 11 at 12:25
@roozbehS you are right ,dat was the cause all the problems IQueryable , when i tried pass IQueryable to view and i changed .ToList() everything get it work :) Merci koliii Roozbeh :) if you like postet as anwser and i will mark as right anwser
– The First
Nov 11 at 12:46
Glad I could help. Added an answer.
– roozbeh S
Nov 11 at 20:24