asp.net mvc 4 - MVC4 dropdown helper with references -


i use mvc4 , trying make dropdown links. wrote helper:

public static mvchtmlstring languageselectordropdown(this system.web.mvc.htmlhelper helper, string name) {   var culture = thread.currentthread.currentculture;   ilist<culture> data = new culturerepository().getenabled();   var items = new list<selectlistitem>();   items.addrange(     (from item in data      select new selectlistitem()      {        text = @"<a href='/home/edit/3'>i link</a>",            //it's example. here run other method dynamic link        value = item.id.tostring(),        selected = culture.name.equals(item.id)      }).tolist());   return new mvchtmlstring(httputility.htmldecode(helper.dropdownlist(name, items).tostring())); } 

at end of method have:

helper.dropdownlist(name, items).tostring() =   "<select id=\"languageselector\" name=\"languageselector\"><option value=\"de-de\">&lt;a href=&#39;/home/edit/3&#39;&gt;i link&lt;/a&gt;</option>\r\n<option value=\"en-us\">&lt;a href=&#39;/home/edit/3&#39;&gt;i link&lt;/a&gt;</option>\r\n<option selected=\"selected\" value=\"ru-ru\">&lt;a href=&#39;/home/edit/3&#39;&gt;i link&lt;/a&gt;</option>\r\n</select>" httputility.htmldecode(helper.dropdownlist(name, items).tostring()) =   "<select id=\"languageselector\" name=\"languageselector\"><option value=\"de-de\"><a href='/home/edit/3'>i link</a></option>\r\n<option value=\"en-us\"><a href='/home/edit/3'>i link</a></option>\r\n<option selected=\"selected\" value=\"ru-ru\"><a href='/home/edit/3'>i link</a></option>\r\n</select>" 

in result html page:

<select id="languageselector" name="languageselector"> <option value="de-de">i link</option> <option value="en-us">i link</option> <option value="ru-ru" selected="selected">i link</option> </select> 

it looks links disappeared. there way force work?


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -