Well, my question is, Is it possible to insert into the database all the values from a 'listbox' control? In my case from the second 'listbox' with all the values passed from the first one? If yes, in my database table I have to create one column (field) for every possible selected option?
Thank you,
Cesarwhat you should do is have a relational table that only holds, lets say, an ID for the user and a field for the selections that have been made.|||I don' t understand what you mean. If I have a table with two fields, 'User_id' and 'product_quality_num', the 'product_quality_num' field has a foreign key related with the 'Product_Q' table. So, the user only can enter the product_quality_num 1, 2, 3, 4, 5 or 6. Then, what happens if the user have selected product_quality_num 1, 3 and 6? The 'product_quality_num' field only accepts one number.. not three (1, 3 and 6)|||You have to get those values back to the server. There have been posts on how to pass back contents of a listbox that were added client sde, but one way you can do it is by adding the IDs to a hidden form field separated by a delimiter like a pipe while you're adding them to the dropdown. The dropdown really is just a visual. The hidden form field is what you really need.
Your hidden field winds up like 1|2|4| when you post back. On the server, grab that value, parse it into an array based on the pipe. Loop through the array calling an insert for each value. Or, you could pass back the string and parse it in a SQL function that does the same thing, but returns a table as its output.
No comments:
Post a Comment