lookup modal search

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
darkdragon
User
Posts: 135

lookup modal search

Post by darkdragon »

Hello,

How can we change the default behaviour when searching in a modal dialog for a lookup field, of matching any letter(s) in Display Field(s)?
I'm interested in changing the behaviour to search for options that start with the typed letters?

So, instead of having this query

SELECT  TOP 100 [ID] AS [lf], [Title] AS [df], '' AS [df2], '' AS [df3], '' AS [df4] FROM dbo.Document_SendersValues WHERE [Title] LIKE N'%pro%'

to this one:

SELECT  TOP 100 [ID] AS [lf], [Title] AS [df], '' AS [df2], '' AS [df3], '' AS [df4] FROM dbo.Document_SendersValues WHERE [Title] LIKE N'pro%'

Regards.


MichaelG
User
Posts: 1017

Post by MichaelG »

You need to customize the "GetModalSearchFilter" function in "Models/src/Lookup.cs". For example, from:

string thisFilter = SearchExpression + Like(QuotedValue(keyword, DataType.String, dbid, "LIKE"), dbid);

to:

string thisFilter = SearchExpression + Like(QuotedValue(keyword, DataType.String, dbid, "STARTS WITH"), dbid);


darkdragon
User
Posts: 135

Post by darkdragon »

Thanks for the tip. Not an easy one solution.
Maybe an option in a future release, to switch between the two.

Thanks.


Post Reply