I'm having a problem with paging in an Ajax RadGrid.
When NeedDataSource is fired, I am dynamicallly retrieving data depending on a list type (that I'm passing through to page).
As an example, if I need to show a list of sizes, I call the following:
1. dv (dataview) = getSizes()
2. getSizes() runs the following code:
Dim dbConn As String = [get conn string]
Dim query As String = ""
Dim selectClause As String = "SELECT ID, AccountType "
Dim fromClause As String = "FROM tbl_WIP_DATA_AccountTypes WITH (NOLOCK) "
Dim whereClause As String = "WHERE Active=1 AND Deleted=0"
If FilterExpression <> "" Then FilterExpression = " AND AccountType LIKE '%" & CleanForSQL(FilterExpression) & "%'"
whereClause &= " " & filterExpression
query = selectClause & " " & fromClause & " " & whereClause & " ORDER BY AccountType ASC"
Return WIP.Data.SqlHelper.ExecuteDataset(dbConn, CommandType.Text, query).Tables(0).DefaultView
Now this works fine! Paging etc works as it should. As you can see, it's dynamic t-sql.
BUT, if the getSizes() functions calls a second function get build a generic sql statement (based on a metadata system),
Radgrid displays the records correctly, but refuses to page.
I've tested the resulting queries and they are identical.
Does anyone have any suggestions why this would not work?!
Cheers in advance,