Well, let's see. According to
Wikipedia, the average square meter of Earth averages 164 watts of sunlight over 24 hours. Current solar panels allegedly average
15% efficiency. They'll probably improve, but let's go with that. So every square meter covered with solar panels produces 24.6 W.
The urban core of Shanghai has a population density of
3854 people per square kilometer. If we assume that in the future they will be wealthier and consume
the current American average of 12986.74 kWh/year/person = 1481.52 W/person, we need each square kilometer of Shanghai to produce 5709783.82 W (in practice, we'd bring in electricity generated outside the city, but let's ignore that for now). Since each square kilometer is a million square meters, that's 5.71 W/m^2. Comparing this to our figure above, we would need to cover 23.2% of Shanghai in solar panels to provide for all of its hypothetical future power needs.
I'm not sure what percentage of a city it's actually practical to cover in solar panels, but that doesn't sound too bad. Taking into account improvements in solar panel efficiency and the fact that we don't actually have to generate all the city's power within the urban core, it seems extremely doable. Of course, the need to store energy until it's needed will add further expense and inefficiency; I don't know enough to say how significant the effect will be.