Is there an option how to obtain the list view rendered html from code?

For example I have an item (for example task ct) and i would like to obtain html rendered (on server side) if this item will be displayed in list view. I know it sounds stupid but ... I would like to know if this is even possible

3 Answers 3



I don't know what exactly you are trying to do...

But you can use SPGridView, a server-side control which behaves just as List View control...

Some samples for using SPGridView control

If you want to use the same look and feel, you can use IE Developer Tools to identify the classes used for the table and use in your code... Or Chrome Inspect Element or FireBug will be helpful...

I hope this helps


It does not sound stupid to me. Recently we used this solution to get number of list items in a view with grouping.

Anyway, there is a SPView.RenderAsHtml() for this purpose.

  • thanks, i know about that, we used for rendering on client side, this is great. however i need to dynamically render the view. therefore i probably prefer the spgridview, but thanks!
    – Ivan
    Commented Feb 24, 2013 at 14:45

I'm not clear exactly what you're trying to do, but if you're looking more at the item level than the view level, there's SPField.GetFieldValueAsHtml(object value) which you could use to get formatted values for individual fields in a list item (There's also SPListItem.GetFormattedValue(string fieldname) - not sure what the difference is there).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.