i need check box return nullable bool value. should do? there tri state check box razer engine? found this question, link not valid.
you create tristate
class, custom modelbinder
class, , corresponding display/edit templates.
the tristate
class should have property store representation of current state, doesn't matter how: example enum
, int
can -1, 0 or 1, or nullable bool bool?
the display template should show state. i.e. can show different images states, , perhaps associated "label".
the edit template should show state , have script allows rotate 3 states when clicked.
for example, edit/display template implemented span text used label state, , have different css styles show image background image span. make easy change image both in server , in client side scripts.
for edit template, span should have:
- a hidden field stores value in way custom
modelbinder
can recover (i.e. format string store value, , parse string recover it) - an script handles click event span , changes sate, i.e. updates value in hidden field, style shows corresponding background image.
so you'd need:
tristate
class- custom
modelbinder
tristate
class. look here, or here. - templates display/edit. read blog: brad wilson: asp.net mvc 2 templates
- syles show different images (define background image , padding text doesn't overwrite image). besides, style change cursor in clickable version (editor template), , perhaps change display on hover, give user hint element clickable.
- client side script change state (only editor template). script i'd recommend add "data-" attribute , attach unobtrusively. see my answer question.
you improve implementing 3 additional properties in class store labels show 3 states. values added "data-" attributes in span, client side script can change label depending on current state.
Comments
Post a Comment