Where condition in LinqDataSource for string in ASP.NET

894 Views Asked by At

I am trying to populate data in gridview by using LinqDataSource and in the where condition of LinqDataSource1 - programmatically I am not sure about the syntax on how to pass a string value to a particular column?

What is the syntax for where condition in LinqDataSource on a string programmatically?

I am familiar with the one in int:

 int id = 5; 

for example:

LinqDataSource1.Where = "ID =" +id;

But, not sure about the syntax for string.

Please suggest something!

1

There are 1 best solutions below

0
Nalini On BEST ANSWER

Ok, finally I got the syntax for string in LinqDataSource:

LinqDataSource1.Where = "Title.Contains("+ "\"" + txtTitle.Text + "\""+ ")";