views:

49

answers:

1

I have ListViews and DataPagers in place throughout my site. Most of them are wrapped in an UpdatePanel for better UX. However, when I start using AJAX to improve UX, I lose value in SEO. What's the right way to get the best of both worlds?

I see that I can add the QueryStringField parameter to the DataPager, which will automatically render HyperLinks instead of LinkButtons and will use the querystring to handle page numbers. One idea I'm having is to create a new DataPager control that renders LinkButtons regardless of the QueryStringField. Then, I could write a new LinkButton control that has both onclick and href. Then, if javascript isn't available the href is used. Thoughts? Better ideas?

+1  A: 

The approach you describe is very appropriate. It's possible you could potentially roll your own alternative that does the same thing a little bit more cleanly, but I'd say the fact that it's pretty much all done for you is a huge win.

In general, it's best to take that approach with all interactive elements in your application - have them link to REST or querystring-decorated resources, and use JavaScript to intercept/override those actions when it's available. It takes a shift in approach but once you get momentum, it's not really much more time-consuming to develop that way. In fact it helps force your application into good patterns of SoC.

Rex M