1

I'm new to lightswitch and i searched lot, but couldn't find proper solution for this simple question. I need to add items to combo box, based on user selection. ( not from existing table)

For example if user select country ,following towns must add to combo box.

USA - Texas, New York etc
UK  - London , Surrey 

How can i do this? i'm using vb.net as my back end. i found this article How to create an unbound combobox as useful one. but couldn't able work according to my scenario.

what is the way to add items to combo box?

DevT
  • 4,843
  • 16
  • 59
  • 92

3 Answers3

3

In Lightswitch, if you want to have a dynamic set of data bound to a control, that data must be in a table. You then need to create a query that filters the data in that table based on the user's selection and bind your control to that query.

Here is a pair of articles that describes implementing a situation that is similar to yours:

Nested AutoCompleteBox for data entry

Nested AutoCompleteBox for data entry Part 2

embedded.kyle
  • 10,976
  • 5
  • 37
  • 56
0

We can't directly assign our own values to combo box. we have to use either data table ( as mentioned by embedded.kyle ) or we have to create custom control to assign values.

i have used custom User Control for above scenario. detail step that i followed can be found in following Link

DevT
  • 4,843
  • 16
  • 59
  • 92
0

Adding a record that doesn't already exist in a bound table is a very common scenario. Unfortunately, there's no out-of-the-box way to do this in LightSwitch, you simply have to write code to achieve it, like in this blog post.

Add non existent records using AutoCompleteBox

Or, of course as was also suggested, you could create a custom control to do the job.

Community
  • 1
  • 1
Yann Duran
  • 3,842
  • 1
  • 24
  • 24