#StackBounty: #html #css #kendo-ui #kendo-grid #dropdown Dropdown list flicker on first click, and pop up opens and closes fast

Bounty: 50

I have kendo drop down list at the bottom of my page. The flickering happens only at first click.

 <select id="TIVSelect" kendo-multi-select ng-if="fieldnameLower == totalSumInsured && isTIVColumnList"  multiple="multiple"
                                                k-template="itemTemplate"
                                                k-data-text-field="'FileColumnName'"
                                                k-data-value-field="'FileColumnName'" k-filter="'contains'"
                                                ng-model="BFCoreFinancialVM.TotalInsurableValue.MappingOptionsColumns"
                                                k-data-source="BFCoreFinancialVM.TotalInsurableValue.ColumnMappingList"
                                                class="m-b form-control" k-on-change="changeMappingOptions(BFCoreFinancialVM.TotalInsurableValue)"
                                                placeholder="'Please select the 'Total Sum Insured' Column'" />


Get this bounty!!!

#StackBounty: #c# #list #dropdown Remove the same values when comparing multiple lists

Bounty: 50

I have 3 people living in 3 houses.

  • Person A (Joe) lives in house 1.
  • Person B (Jane) lives in house 2.
  • Person C (Max) lives in house 3.

I have a button with which I make an assignment for certain persons. It becomes a kind of user administration.
E.g. person A has the permission to enter house C.

I would like to be able to display only the houses that have not been assigned yet.

Illustrated as follows:

  • Joe is the owner of house A and caretaker of house B.

If I want to assign him a new role now (caretaker of house C), I want only house C (the only unassigned house) to be displayed in the dropdown list.

enter image description here

Problem: Currently all houses are displayed.

Code structure:

I can create a new person or edit an existing person.
I have an enum class for role assignment:

public enum RoleType
{
    [Display(Name = "Owner")]
    Owner = 0,

    [Display(Name = "Janitor")]
    Janitor = 1
}

I also have a model for role definition:

public class RoleDefinitionModel
{
    private RoleType? _role;
    private House _selectedHouse;

    public RoleDefinitionModel(IList<House> availableHouse, RoleType? selectedRole, House selectedHouse)
    {
        AvailableHouses = availableHouse;
        _role = selectedRole;
        _selectedHouse = selectedHouse;
        StartChangeTracking();
    }

    public virtual RoleType? SelectedRole
    {
        get { return _role; }
        set
        {
            if (_role == value)
                return;
            _role = value;
            NotifyChanges();
        }
    }

    public virtual House SelectedHouse
    {
        get { return _selectedHouse; }

        set
        {
            if (_selectedHouse == value)
                return;
            _selectedHouse = value;
            NotifyChanges();
        }
    }

    public virtual IList<House> AvailableHouses { get; }

    public virtual IList<RoleType> AvailableRoles { get; } = Enum<RoleType>.GetValues().ToList();
}

I already have an add and remove method, which also work.
There is only one problem: When I click on the button I get my desired dropdown. But I can select all houses.
And I only want to see the houses to which I have not been assigned a role yet.

public virtual void AddRoleDefinition()
{
    var roleDefinition = new RoleDefinitionModel(House, null, null);
    _roleDefinitions.Add(roleDefinition);
    this.SubscribeChanged(roleDefinition);
}

Which is the most effective way to check it:

  • Where() and Any() from System.Linq:

_roleDefinitions.Where(....Any());

  • Contains()

  • or Remove() in a foreach-loop?

for (var i = selectedHouse.Count - 1; i >= 0; --i)
{
    if (availableHouses.Contains(selectedHouse[i].Uid))
    {
        availableHouses.Remove(selectedHouse[i]);
    }
}

foreach (var selectedhouse in availableHouses)
{
    ...
}

However, I think this approach is wrong and my queries are wrong here.

I would ask you to help me to solve this problem in the best way possible. Thanks!


Get this bounty!!!

How to make a dropdown as readonly in html

I encountered a problem where in it was required to make a drop down readonly.

While searching over internet i found THIS
But the solution mentioned there, didn’t appeal me much. As i had to make server side code changes while saving the value using the hidden field.

How do we do this? The common thought is to disable the drop down menu. Well, yes, but there’s a choice

When you use disabled, it prevents the user from using the drop down, or form element. You can see the year, but it is grayed out. Your mouse can’t select or change it, and you can’t tab to it with the keyboard. Disabled is used a lot with checkboxes. Sounds like just what we want, but you unknowingly might have caused yourself a small development problem.

The problem is “disabled” does just that. Disabled means that in your $_POST or $_GET that element will not show up in your controller. If you want to use the year in your controller, you won’t be able to recover it from that form. All you can do it look at the value on the web page.

What if we want to read the year, prevent the user from changing the year, and recover the year in the form data sent back to the controller. The solution for this is

Make a replica of your dropdown with a different name and different id.

Hide your original drop down with
This makes the element available in the form, so it will flow to the server side as well.
At the same time, it will give a look and feel of disabled to the user.

Example :