c# mvc expression to html -
alright, here's deal. able create custom dropdown box system.linq.expressions.expression in c#. know there helpers, dropdownlistfor, i'm not sure how make 1 scratch, or how pull values etc expression.
essentially why i'm doing if use dropdownlistfor 'select' <option> based on it's value, want 'select' option based on it's text instead. if has idea how instead, great.
this have far
public static mvchtmlstring validatededitabledropdownlistfor<tmodel,tproperty>( htmlhelper<tmodel> htmlhelper, expression<func<tmodel, tproperty>> expression, selectlist list, string defaultoption, object attribs) { //basically puts strings html template<div>{0}{1}</div> etc. return getvalidatedhtml( htmlhelper.labelfor(expression).tostring() , htmlhelper.dropdownlistfor(expression , list , defaultoption , attribs).tostring() ,htmlhelper.getvalidatederrormessage(expression),false,"editabledropdown"); } any ideas on how can have dropdownlistfor make <option> selected, or how create own html element based on expression , selectlist appreciated.
thanks.
why not pass list of selectedlistitems view correct 1 selected it's text controller
Comments
Post a Comment