Search Results

Search found 2 results on 1 pages for 'leeg'.

Page 1/1 | 1 

  • Predicate problem in ToSelectList

    - by Stefanvds
    the ToSelectList method I have: public static IList<SelectListItem> ToSelectList<T>(this IEnumerable<T> itemsToMap, Func<T, string> textProperty, Func<T, string> valueProperty, Predicate<T> isSelected) { var result = new List<SelectListItem>(); foreach (var item in itemsToMap) { result.Add(new SelectListItem { Value = valueProperty(item), Text = textProperty(item), Selected = isSelected(item) }); } return result; } when I call this method here: public static List<SelectListItem> lesgeverList(int selectedID) { NASDataContext _db = new NASDataContext(); var lesg = (from l in _db.Lesgevers where l.LG_Naam != "leeg" orderby l.LG_Naam select l).ToSelectList(m => m.LG_Naam + " " + m.LG_Vnaam, m => m.LG_ID.ToString(), m => m.LG_ID == selectedID); return lesg.ToList(); } the selectlist I get has the selectedID as selected. now, when I want to have multiple selected items, I give a list of Lesgevers public static List<SelectListItem> lesgeverList(List<Lesgever> lg) { NASDataContext _db = new NASDataContext(); var test = (from l in _db.Lesgevers where l.LG_Naam != "leeg" && lg.Contains(l) orderby l.LG_Naam, l.LG_Vnaam select l).ToList(); var lesg = (from l in _db.Lesgevers where l.LG_Naam != "leeg" orderby l.LG_Naam, l.LG_Vnaam select l).ToSelectList(m => m.LG_Naam + " " + m.LG_Vnaam, m => m.LG_ID.ToString(), m => lg.Contains(m)); return lesg.ToList(); } the var test does return the Lesgevers that i have in the lg List, in my 'var lesg', there are no selectlistitem's selected at all. where is my mistake? :) how do I fix thix?

    Read the article

  • stting environment variables in powershell by calling python script that prints $env:myVar=myvalue

    - by leeg
    I have some legacy python scripts that manage my shell environment for all the programs and plugins I am running on Linux (bash) and windows (cmd.exe). I want to port this to powershell. How do I set environment variables in powershell by calling python script that prints $env:myVar=myvalue and causes my environment variable to persist in the powershell. In Bash I can use a bash function to call my python script which prints export var=value to stdout and the function will set the environment variables in my shell. This will also work in windows cmd shell by calling a .bat file. I cannot figure out how to do this in powershell. I think it should be something like this: setvar.ps1: function SETVAR {c:\python26\python.exe varconfig.py } varconfig.py: import sys print >> sys.stdout, '$env:myVar=foo'

    Read the article

1