One thing that you can try is to go into settings->applications->manage applications. Wait for the list the refresh and look for market. Tap it and tap the button "clear data". See if the market now works.
You mention WiFi - are you sure that it's connected? Does the browser app connect to any web sites? If not, try settings->wireless & networks, find the WiFi AP you are connected to, tap and hold on the name and tell it to forget the network. Try to connect again.
If neither work, try a factory reset again.