Lightswitch: parameter with string and integer sea

2019-09-06 16:01发布

问题:

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

回答1:

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.