I have 5 Items like example Name,age,experience,company and country search these all 5 Items are out of gridview and when type name then by name search like age so on.
Search gridview by 5 Items please provide code will helpful. Thank you in advance.
select * from table where
(@name is null or name like '%@name%') and
(@age is null or age = @age) and
(@experience is null or experience like '%@experience%').. etc
Member
167 Points
368 Posts
Search using Gridview using C# ASP.NET Web Forms
Jun 21, 2017 06:01 AM|mazhar khan india|LINK
I have 5 Items like example Name,age,experience,company and country search these all 5 Items are out of gridview and when type name then by name search like age so on.
Search gridview by 5 Items please provide code will helpful. Thank you in advance.
All-Star
184748 Points
26712 Posts
Moderator
MVP
Re: Search using Gridview using C# ASP.NET Web Forms
Jun 21, 2017 06:44 AM|Mikesdotnetting|LINK
Use optional parameters in your SQL/LINQ query:
SQL:
LINQ:
ASP.NET Tutorials | Learn Entity Framework Core| Learn Razor Pages
Member
167 Points
368 Posts
Re: Search using Gridview using C# ASP.NET Web Forms
Jun 21, 2017 07:00 AM|mazhar khan india|LINK
Dear Mikes,
I understood sql select query, can give more code for Linq because I am new in Linq. Thank you
All-Star
184748 Points
26712 Posts
Moderator
MVP
Re: Search using Gridview using C# ASP.NET Web Forms
Jun 21, 2017 10:01 AM|Mikesdotnetting|LINK
If you are new to LINQ, you should read the list of examples here to understand how they work: https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
ASP.NET Tutorials | Learn Entity Framework Core| Learn Razor Pages