Search code examples
javascriptvisual-studio-lightswitchlightswitch-2013

Lightswitch: parameter with string and integer searching properties (is it possible?)


Just a quick question within the HTML Client side of Visual Studio 2013 Lightswitch, is it possible to set a parameter field based from a query to allow both sting and interger values to be searched...

an example would be StaffID(int) and StaffName(string)...

cheers guys


Solution

  • Sure - just add a .ToString() when you present on your int to the search query argument if Javascript isn't doing the conversion implicitly.

    e.g.

    searchString = intField.ToString() + ((intField==null)?" ";"") 
                      + strField.ToString() + ((strField==null)?" ";"")
                      + datefield.ToString()
    

    Add this into the Executing event of the button that submits the search. Make sure you use the "Contains" operator if you're going to try a concatenated search string like the one I've built here.