Tag Archives: html

Html.EditorFor

creating html stuff with asp.net mvc i really easy… thanks to the htmlhelper class… for example to create a input box:

@Html.EditorFor(model => model.Name)

this line of code renders the <input>-tag, with set value, name… based on the models attribute… so if its a string it renders a textbox… it its a bool, it renders a checkbox… this checkbox is rendered a little bit special, because there is always a hidden filed set false… i think this is needed to return always a value for the checkbox, even if its not checked… sounds great, but the result must be checked differently:

active = (collection[<checkboxName>].Contains(“true”) ? true : false);

Its a really cool helper… but has a really big problem… Html.EditorFor is currently not able to set a class… there for desinging the input fields is hard… for a textbox it renders class=”text-box single-line”… so simply add these to your css file… works good, but with a company wide stylesheet its kinda crap…

asp.net mvc

at work i needed to create a new web frontend… and actually i am really disapointed with microsoft web framework asp.net… for me it is too random… ok i dont know how to do it correctly, but i am really confused with the 32452390918745 events, which will be called every postback (postback? never thought in java, that there might be different types of postback… and handlers…)… but yeah… did some application with asp.net and they all work… and are running… i think… 🙂

new project. new technology: asp.net mvc. i like it… the concept is as stated in the name: mvc… and actually i think it is really good implemented and totally included into visual studio… simple create a controller… based on it create views and of course use the model… the where is my model thing is for me not yet 100% clear… when using a external project/dll… is the dll the model? or is the dll only the functionality for the controller to fill the model? or is the model a wrapper around the dll? currently using a bit of all possibilities… works, but fareaway from perfect…

X-UA-Compatible

i had a problem with my super simple asp.net site… designed in locally with style sheets and looked cool 🙂 but after putting it on the IIS7 it looked completly different… wtf? after trying everything, renaming stuff, reconfigure the IIS, swear a lot… i found:

<meta http-equiv=”X-UA-Compatible” content=”IE=100″ />

ok it didnt really help, put it is the solution… 🙂

the X-UA-Compatible defines the render version browser of given website… so if IE=7, every newer browser tries to render the website with the IE7 rendering mechanism… every older browser renders it with its own rendering mechanism… so if set to 100 the browser renders it with his mechanism… as long as Microsoft doesnt release the IE101, when i hopefully do not create html anymore… …

but the meta-tag was not the solution in my case… IIS7 stores the X-UA-Compatible localy for every application… which can be set on the IIS7 in the http-header… that was the solution 🙂

read more