How to force IE8 Compatability View

Category : ASP.Net

IE8 has issues with many pages and it’s formatting.

So if you want IE8 to look like IE7 you can embed a meta tag in your pages.

What I have found is that the meta tag needs to be right under the <title> tag in your head before anything else.

Here’s the tag : <meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />

Hope this helps!

ASP.NET / HTML Controls

Category : ASP.Net

I’m sure there are reasons against it but I have come to prefer to use HTML controls over ASP.Net when possible. The reason is that I can perform standard Javascript functions on the control on the markup side without having to do all the Add.Attribute coding on the backend BUT I can still call the control from the code-behind.

To be able to call the control and do other code-behind work on this HTML control, I simply have to add this to the control of my markup: runat=”server”. For example, if I wanted to create an HTML textbox in my asp markup page but also wanted to be able to work with it in code-behind, I simply drag the HTML control to the canvas and then add the runat server in it’s tag like so:

<input id=”address1″ name=”address1″ runat=”server” size=”15″ type=”text”  />

Then in your code behind you simply reference the control as such:

address1.Value = “whatever value I want it to equal”

it works great for me….

**BTW – I did find this useful table that you may need (although you shouldn’t need it with the above example).  If you want to be able to declare an HTML control in your code behind, the following table tells you what .Net calls them.

HTML Control HTML representation Declare as / Description
HTML Label <div> HtmlGenericControl
HTML Button <input type=”button”> HtmlButton
HTML TextBox <input> HtmlInputText
HTML TextArea <textarea> HtmlTextArea
HTML Password <input type=”password”> HtmlInputText
HTML Submit Button <input type=”submit”> HtmlInputButton
HTML Reset Button <input type=”reset”> HtmlInputButton
HTML Image Button <input type=”image”> HtmlInputImage
HTML CheckBox <input type=”checkbox”> HtmlInputCheckBox
HTML Radio Button <input type=”radio”> HtmlInputRadioButton
HTML DropDown <select> HtmlSelect
HTML ListBox <select> HtmlSelect
HTML Hidden Field HtmlInputHidden
HTML File Upload <input type=”file”> HtmlInputFile
HTML Anchor <a> HtmlAnchor
HTML Image HtmlImage
HTML Table <table> HtmlTable
HTML Span <span> HtmlGenericControl
HTML Div <div> HtmlGenericControl
HTML Flow Panel <div ms_positioning=FlowLayout> HtmlGenericControl
HTML Grid Panel HtmlGenericControl
HTML Horizontal Rule <hr> HtmlGenericControl