HtmlDropdownlist which has option with multiple values - html-select

i want to create MVC razor HtmlDropdownlist which has option with multiple values
like option has name and class both attributes of student.
when i want to select dropdownlist both attributes appear same time.
abc 123
dfg 456

if you are going to extract these values from database you can concatenate the two fields as one and extract it to the list.. and finally show the list to dropdown..

Related

Single form to create multiple SKU's from user options

This is complicated and difficult to explain, but here it goes. I have created a db that works just fine. It is a time saver, but not efficient for the user. I have a form for the merchandise where the user selects a paper type from a combobox. They are presented with two choices. They must also select a print size from another combobox. They are presented with 5 choices. I have VBA code that creates a SKU number based on these selections.
An art piece can use both paper types and be available in all 5 sizes. What I am trying to figure out is how I can offer all the possible choices on this form, allow the user to select options for that piece. As an example, the user chooses both paper types and all print sizes. This would create 10 SKU numbers for one art piece. Below is a copy of the form in it's current view:
Is this possible to do from one form? If so, how can this be accomplished in the most efficient way? I feel that it can. In VBA, this would be an IF nest nightmare, especially when concatenating the SKU variables. Either Select statements or another method that I am unaware of, could be the solution.
Thanks in advance for any and all suggestions and assistance.
EDIT: I hope this helps clarify. I would prefer to use this form
to complete the task. The checkboxes are not in an option group so they could all be checked if the user requires it. For the purposes of this question, let's assume the user has checked all the boxes. This would equal 10 total combinations.
I run this sub to generate a SKU based on the paper type and the print size:
Private Function UpdateArtwork()
Me.MerchandiseSKU = Me.cboArtworkID_A5A.Column(5) & _
Me.cboPrintTypeID_A5A.Column(2) & Me.cboPaperTypeID_A5A.Column(0) & _
Format(Me.cboPrintSizeID_A5A.Column(0), "00")
Call UpdateArtworkPic
End Function
I am trying to figure out how to write the code for the new form that allows all 10 SKU numbers to be generated and create 10 new records for Artwork_ID (Artwork table).
I think that the best way of doing this would be to create a new table, called tblArtworkSKU, which has the following fields:
ArtworkSKU_ID - Autonumber, primary key;
Artwork_ID - number, foreign key from the Artwork table;
PrintSize_ID - foreign key from the PrintSize table;
PrintType_ID - foreign key from the PrintType table;
ArtworkSKU - text.
You would then create a small continuous form based on this table, with PrintSize_ID and PrintType_ID selected through combo boxes. When you place this form onto the main form that you have, Access should automatically let you join on Artwork_ID to create a one-to-many relationship.
You could then use the AfterUpdate events of each combo box to create the SKU.
Regards,

generating reports in rails like crystal report in VB

I'm looking for a way to generate reports from view, like suppose I have model named "User" having fields "first_name, last_name,email, user_name ".
I will be having a view in which I will be having 2 select field, first one having model names and second one will be multiple select box where I can select model attribute that I can show in report.
How to generate report for selected attribute of specific model?
Personally I'd hardcode both select tags as not every field on the model might be worth filtering for. But for the sake of your question, ActiveRecord allows you to ask for the columns a model has in the database, e.g.
User.column_names
or
User.columns

How to get right values from array thats values are in other table

I have the list of records saved as array in database like below:
---
- '9'
- '10'
- '11'
These are saved in option_ids column in table.
I have another table in which they all are present like below.
What I need to do is to print the values text like speak well if its id is present in options_ids column. So, what will happen is, if options_ids contains 9,10,12 etc so we will print data from other rows table like speak well, read well, listen well.
Assuming your "other table" is class OtherTable and assuming your fourth column is called text then you'd want to do
options_ids.map{|option| OtherTable.find(option).text}.join(', ')
When using rails you should take advantage of Active Record Associations.
I guess that a user(?) can choose different options from that second table.
The association would be a has_and_belongs_to_many-relation.
A good read is this section in the rails guide: http://guides.rubyonrails.org/association_basics.html#the-has-and-belongs-to-many-association
Basically you set up a join table between users and options and tell the two models that they have a has_and_belongs_to_many-relation with each other.
Then when you fetch a user you can simple call user.options and it shows the options that are related to that user object.

Rails: Create a drop down list (within a form) where it's possible to select more than one value

(I've made up the example below as it's clearer than going through my specific case.)
Suppose I have a form for a User, and that the underlying User table has a personality_traits field; an array of the user's personality traits. Is there a standard way in rails to create a drop-down list so that the user can pick any number of a selection of attributes (e.g., "easy-going", "fun-loving", "quick-tempered"), and have these ultimately feed into the personality_traits field as an array? If not, does anyone know of a particularly good method?
bootstrap multiselect will do what you're looking for

Delete attribute / column from simpledb

I have a simpledb column 'Status' I want to get rid of it. How can I delete it ? I dont see any intuitive way to do so.
Thanks
Since SimpleDB is a schema-less database each item may have different sets of attributes. In order to remove a particular attribute from all items you're going to need the itemNames for all items containing the attribute.
If you've decided to emulate a relational table in SimpleDB (by having one domain per 'table' and uniform attributes per item) you can retrieve all itemNames by a simple select query select itemName from domainX.
Once you've got the itemNames for the items which contain your unwanted attribute you'll need to call DeleteAttributes once for each item.

Resources