locked
In Visual Studio LightSwitch, How to set a foreign key by letting the user type the Id on the screen? RRS feed

  • Question

  • I am working with Visual Studio Lightswitch 2012

    I have a table called Orders which has a Foreign key to a table called Employees. Every time the user enters a new order, the employee must be set. I have everything setup in Lightswitch and is working great. A screen for new orders, presents a dropdown box which lets the user select the employee to which the order is related, I can also set a modal form for chosing the employee. My problem is this: the employee table may have a 2 or 3 thousand active records. So I dont want the user searching through all the records every time a new order is captured either in the drop down list or in a modal form. Is there a way to let the user input the Employee Id in a text box, fetch just that record from the database and if it exists then set it up as the foreign key of the orders table?

    Any help will be apreciated, thank you

    Saturday, October 12, 2013 6:57 PM

Answers

  • LightSwitch does support type ahead functionality on it's auto complete box but it does load extra data that may not be desirable in all scenarios.  LightSwitch does not provide the functionality you want out of the box, although it should be relatively easy for you to create.  Are you using a SL or HTML client?  What type of screen do you want this behavior on?
    Monday, October 14, 2013 1:57 PM

All replies

  • LightSwitch does support type ahead functionality on it's auto complete box but it does load extra data that may not be desirable in all scenarios.  LightSwitch does not provide the functionality you want out of the box, although it should be relatively easy for you to create.  Are you using a SL or HTML client?  What type of screen do you want this behavior on?
    Monday, October 14, 2013 1:57 PM
  • Thank you for your reply. I am using a SL client.
    Monday, October 14, 2013 4:25 PM