Do you have any way to bind a sql to Ig grid?
You can read the feature parameters from the URL such as pageIndex and pageSize, and build your own query logic depending on your backend. In SQL this will translate to setting TOP/LIMIT clauses, ORDER BY, etc.
With the MVC Wrappers you get this done for you, yes.
Thanks,
Angel
By this way, we lost the server-side pagging,sorting... right?
you don't need to use the MVC extensions or LINQ in order to bind a simple client-side grid (pure client side, no .NET Code) to an SQL backend. you just need to create a REST service which returns the results from the SQL query in JSON arrays, and set the dataSource of the grid to the URL of your service. you can find various tutorials on the web which show how to create REST web services with either .NET or some other backend (such as PHP). You can use a SqlDataAdapter to fill a DataSet from your query and then build a list of business objects (plain class with properties corresponding to the columns). then the resulting list will be automatically serialized by the service. - in case you're using a WCF service, for instance.
DataSet ds = new DataSet(); using (SqlDataAdapter da = new SqlDataAdapter(sqlCmd)) { da.Fill(ds, "Products"); }
Hope it helps. Thanks,
No prob - glad you liked the solution :)And thanks for sharing the code needed in order to get it going.Let me just beautify it for anyone reading this thread:
IQueryable<Currency> currencies = context.Query<Currency>("select * from Currencies");currencies = currencies.Where<Currency>(c => c.CurrencyISOCode.Equals("1"));var list = currencies.ToList<Currency>();
which translates to: (@p0 nvarchar(1)) SELECT [t1].CurrencyNumber AS [CurrencyNumber],
[t1].CurrencyISOCode AS [CurrencyISOCode] FROM ( select * from Currencies ) [t1] WHERE [t1].CurrencyISOCode = @p0
hi Borislav
Thank you! I have tried Devart LINQ to SQL. It's exact what I want.
I have following codes.
Here is the generated SQL:
(@p0 nvarchar(1))SELECT [t1].CurrencyNumber AS [CurrencyNumber], [t1].CurrencyISOCode AS [CurrencyISOCode] FROM ( select * from Currencies ) [t1] WHERE [t1].CurrencyISOCode = @p0