ASP.net controls: Browser compatibility - asp.net

I'm using some ASP.net controls in my project especially WEbcombo,Grid(for inline editing) and i face t working good in firefox and IE6 but not in Safari(throwing exceptions).
so i just wanna know or want a list of ASP.net controls which could not work(if any) in safari(not compatible)
Can u help me in this?
Or do u have anything like which can be included in the ASP code so that i dont have browser compatibility problems (like any code to be included in web.config file OR sumthin )
Do i make sense ?

Here is a good link for debugging in the Safari browser. If you are dead set on setting compatibility, you might need this. It focuses more on javascript but people around the campfire say it's good general knowledge. I do not pretend to be an expert in anything Safari, but might be a step in the right direction. Also this article handles a few more asp .net Safari issues.

ASP.Net is a server side technology. This means that controls are rendered to HTML by the server before being sent to the browser. So in most cases, you shouldn't have to worry about what the browser is doing when it comes to ASP.Net controls. Instead you only have to worry about differences in HTML rendering.

Related

asp.net mobile web applications

I'm working in a web mobile application to support a mimimal subset of operations for an existing website.
My base tools are, asp.net 4.0 with simple css to try to archive a more extensive range of devices.
My questions are:
- I'm in a good direction? ... or ther's a better way to do it? (other kind of controls, etc..)
- My device (mobile) is a Nokia e71 and i'm starting to see some glitches:
- autopostback properties dont work
- clientvalidationscripts dont work
Please give me some hints and advices. Thank u all.
Are you using the Mobile controls in ASP.NET, or just the regular ones? There is a separate set that are intended to support and adjust to various mobile devices somewhat better.
For a first-effort mobile site, I would look either at a well-established mobile framework (to be honest, I've never extensively used the ASP.NET Mobile Webforms controls), or to do something where I'm building my own HTML much more directly, to be sure to keep things mobile-safe.
That's one of the reasons I use ASP.NET MVC more myself, now... but that is a bit of a leap to make, and especially if it would just be for mobile use.
So anyway, if you are already using the ASP.NET Mobile controls, my answer is irrelevant!
Always, regardless of the type of website, design for "Progressive enhancement".
In other words, get everything working using the minimum (no javascript, very simple CSS). Then progressively enhance it so that additional functionality is available to those with browsers that can support it.
Many ASP.NET controls have javascript behind them. Ensure that you design so that they continue to work without javascript, or use other controls that don't require javascript at all.
WRT your client validation - You should always validate on the server side as well. In that case the fact that on some devices the client validation isn't running makes no real difference.
Do not use any asp.net control on a mobile site, .net rendering by device usually screws things up.
Do not use .net server forms.
If you can use MVC
Simple javascripts should work most of the modern devices.
Ajax works too but don't use jQuery, write simple ajax post/get functons

ASP.net site looks completely different on IE, Firefox, and Chrome; why?

I'm doing css for a website. I send the html and css to a guy, he puts it into ASP.net. The problem is that the transfer didn't end well for my code and it needs some fixing. The problem is that when I look at it in Chrome, or Firefox, or IE8, I get three completely different renderings. I spent a good amount of time trying to fix a drop-down menu that is supposed to appear while hovering over a link. The one he had in place from ASP.net worked in IE, kinda worked in Firefox, and was completely broken in Chrome (I haven't tested Safari or Opera.) Just getting it to look basically the same in firefox and chrome was a struggle. The html source is showing me two completely different pages as well.
Does anyone have experience with this? I know nothing of ASP.net, and it seems like the guy is modifying my layout with a wsyiwyg (I found tables used in random places, which I did not put there.) Faced with this, what is my best option? Is this fixable, or am I in over my head?
Many times WYSIWYG programs don't generate code that results in reliable, consistent renderings. However, there are a few things you can do to check your site's consistency.
You can use a program like Adobe BrowserLab (there's a free trial right now) to automatically render your page in multiple browsers side by side
You can use the w3 Validator to make sure that your code is standards compliant. If your code isn't standards compliant, then you will likely have issues across browsers.
Note that you can force asp.net to generate XHTML Transitional- or Strict-compliant code (if that's the standard you choose to implement) via the web.config file. Use the directive
<xhtmlConformance mode="Transitional"/>
if you want to enable this behavior.
Was your code rendering fine in those browsers before you sent it off to the .NET guy? If so, the programmer is doing something to muck up your work. ASP .NET won't change the way your code renders... it's simply the Windows equivalent of PHP (simply put).
I would suggest (if you haven't already) testing your code before hand-off to verify proper rendering. Take some screenshots, and if after sending your code to this developer things break, you can point out that it was working until he started messing with your markup. If that ends up being the case, at least you know it wasn't you. If it was, then we have more work to do. :)
Can you provide any samples?
The html source is showing me two completely different pages as well.
That sounds like your asp.net guy is doing something wrong there. You can use asp.net to do browser-dependant rendering, but it sounds more like his job is to just make the site render what you gave him, and it's usually better to get your html and css right to begin with.

Do I need AJAX and ASP.NET for what I'm doing?

Easy question. I used to develop websites back in the days of "classic" ASP, and when I'm asked to do a quick and dirty website for family or friends now, I still resort to direct HTML/ASP and some basic CSS and Javascript - I can get the sites up pretty quickly this way. However, I've had a few requests to design and develop some sites for pay, and thought I should catch up on my web skills. I have been using .NET 3.5, XAML/WPF, etc. for Windows apps, so I'm up on .NET, I'm just behind on the web end.
To the question: If I want to design/code a site that looks identical on all (at least somewhat recent) browsers and platforms, should I be using ASP.NET and AJAX? There might be a little database activity on the site, but not much, so I don't need an enterprise level, multi-tier extendable architecture... just something that looks good and works on multiple platforms without having to code all variations for each browser. After looking at all the ASP.NET books at the bookstore, it seems they all focus mostly on data and postback stuff. Is it still a legit option to use some basic, boring html and javascript with some Flash embedded where needed?
Let me know if I need to clarify the question. Thanks for your advice in advance!
Your question is more loaded than you think, but let me try to address a few points that I think are relevant.
First, how a site looks is almost completely dependent on the HTML/CSS you use and how you code the front end of the site and only slightly dependent on the server technology. So if you want your site to function across browsers and platforms, learn to code following web standards, with semantic markup. (Search on those terms for more info).
Also, ASP.NET comes in two flavors now: ASP.NET MVC and normal ASP.NET. I highly recommend, if you are going to get into ASP.NET, that you follow the MVC platform. It closely follows similar technologies (like Ruby on Rails) and will make the transition to other MVC platforms easier on you. Also, the MVC platform doesn't try to output as much pre-made HTML as straight ASP.NET will when you use their "drag and drop" controls.
Secondly, it really depends on the sites you are building, but straight JS (or JS + jQuery), CSS, and HTML -- and please don't use Flash unless you are embedding a video -- will actually work for a number of basic sites. If you need some things to happen on the server, PHP makes for a great platform. If you are working with advanced database access, and program flow, and since you are already familiar with .NET, then stick with it... MS has some great tools and resources to help you out.
Finally, a lot of developers use a favorite CMS or blogging platform as the backend of simple sites that still need the ability to manage the content easily. Expression Engine (CMS) and WordPress (Blog/Lite-CMS) are often used (both PHP based) but there are tons out there.
Good luck stepping up your game!
I would recommend learning jQuery. This will give you a browser independent abstraction for your JavaScript.
ASP.NET controls will render it's controls in a browser independent way, but that doesn't mean your site will automagically be browser independent. You still need to know how elements are rendered differently in different browsers.
I'd also recommend using a CSS Reset sheet as a starting point for your CSS.
All in all, if you've been developing old school ASP, you'll probably really love ASP.NET as it will save you a lot of time and looping. You may want to jump right in to ASP.NET MVC too.
To the root of your question, I'd learn ASP.NET if you're doing anything more than a simple brochure site. If you have .NET experience, and classic web development experience, then learning ASP.NET is not going to be a big hurdle and will be well worth the effort.
I agree with Aaron Daniels' answer about learning jQuery. jQuery helps a lot with cross-browser compatibility in JavaScript and some CSS-based effects.
However, you should also look into ensuring your site uses well-formed, valid HTML, and doesn't use too many CSS 2+ features. This should ensure that your site is standards compliant, which will mean it will play well with Firefox, Safari, Opera, and even later versions of IE to an extent. You will still need to do manual tweaking for IE - it's been too broken for too long for MS to be able to fix it properly in one go - so look into conditional comments for applying a separate stylesheet for IE users.
AJAX is a handy technology for "desktopifying" your web app. It provides a mechanism for asynchronous callbacks to the web server, so you can pass data to and fro without reloading the page in the browser window. This is how the voting buttons work on StackOverflow, for example.
Lastly, ASP.NET doesn't really have much effect on the end user's experience in terms of the look and feel of the site. It is a server technology that provides for writing complex applications to be delivered over the web to a browser. Having said that, MS have put in some extra goodies to make working with AJAX a little easier.
Hope that helps!

Is it possible to have Client-side Validation WITHOUT Javascript

simple question really (can hazard a guess but just need to make sure),
Just need a Yes/No answer as can't seem to claify anywhere.
Reason? Web pages for phones, where javascript support is "sketchy" among all mobile browsers, so doing away with anything javascript altogether and was wondering if there are any alternatives.
(Also before someone tells me off, I am of course implementing server-side validation by default, better if possible to validate stuff right away on the client as phone text entry isn't particulaly fun to go through multiple times. Also webpage is asp.net 2.0 & c# should that affect anything)
No, there is not.
I mean, obviously, the more involved answer is "Yes, of course, there are other types of client-side scripting systems (Flash/Silverlight/ActiveX/etc) that can do it", but in the context of your question (phones) then the answer is No.
I do suggest, however, that you may be surprised at what phones run JavaScript. Keep it basic, and keep it such that it fails gracefully (i.e. no harm comes to the functionality of the app with JS disabled) and you'll probably be surprised at the compatibility.
HTML itself allows for a very little bit of validation (the maxlength of the input forms, which is not much, as a validation).
Which means you need "more", to do real/useful validation on the client side...
, if you want something that works in almost every browser, that's accessible, that doesn't annoy the user, ...
As a sidenote : don't ever forget server-side validation !
(Yes, you said it in your question -- but it's never said too many times ^^ )
Yes — but only in an even more limited range of browsers than those which support (and have enabled) JS.
e.g. You could use client side VBScript.
No , there is nothing except for javascript for client side for client side validation for the time being.
But it seems that HTML5 has some interesting tags thet will help. http://dev.w3.org/html5/spec/forms.html
It is possible to validate HTML forms without JavaScript now. Have a look at How to validate HTML5 forms without JavaScript
Not really. HTML itself only allows to limit the maximum length of a text box, which is some sort of "validation" (by restriction).
But then again - very many mobile browsers DO run JavaScript, even "Opera Mini" does support basic (or not that basic?) things of JS. Mobile Opera has full JS support, IE - too.
There is a nice list of who-can-do-it on QuirksMode.org (here: http://www.quirksmode.org/m/table.html)
One thing I'd suggest looking at is the Mobile Device Browser File - you state that you're using ASP.NET 2.0, so provided that your server's up to date (i.e. it has .NET Framework 2.0 SP2 installed), you should be able to use it.
This will help your site determine which browser is viewing your site, what it supports in terms of controls, etc, and help you respond appropriately to the requests.
I.e. if you know in advance that the browser doesn't support JavaScript, you can remove the client side validation altogether and not send all the extra markup to the browser, making their experience of the site even cleaner.
Basically, no.
If your market includes browsers that support the new HTML5 input types, there's some very basic things you can do there: http://diveintohtml5.ep.io/forms.html
Beyond that though, Javascript is really the only real client-side option.
(It could also be done in VBScript, but only in Internet Explorer)

How to embed HTML created by Dreamweaver into an ASP.NET applicaton

I've been asked by a friend, who created a very visually appealing website mostly in Dreamweaver, to add some database backed functionality that I really only know how to do in ASP.NET. The problem is when I load his generated HTML into an ASPX page it renders it quite horribly. I've tried adding a basic .html page to an ASP.NET project but it still looks funky. He's on a Mac and i'm (obviously) using a Windows box. Is there a clean way to take a quite complete (but quite static) website and add ASP.NET functionality to it? Any comments are very much welcome. Thanks!
Just a quick thought.
You state in your comment:
Everything works is just doesn't look near as good as it did in the Safari browser
Where doesn't it look as good as it did in the Safari browser? When served as a page from a webserver (either the built-in cassini server, or IIS) in IE/Firefox, or when you switch to design view in Visual Studio?
Visual Studio has a lot of trouble rendering things correctly - it's really not standards compliant by anyone's definition - VS2010 is apparently much better - for example, try looking at this page: display/box/float/clear test in a browser and in the VS designer - very different.
If you mean in the browser, which browser? Have you tried looking at it Firefox instead? It's possible that if it's been built to look nice in Safari that it will work in Firefox, but there may be issues with the rendering/layouts in IE - this is a fairly well known issue.
If all the stylesheets are being correctly called (check with Firebug for Firefox for example) then there are probably some issues with the CSS that need to be addressed for IE.
ASP.NET does not alter the rendering of standard HTML. So there must be some other issue like a missing stylesheet (either all together or a broken link) or images. Once you have the HTML properly copied over and solve the display issue, you can add in the ASP.NET controls and code you need to make it functional.

Resources