Filed under: MOSS
Just going to drop this in here, but it is also possible to extend the web part I wrote about earlier that would render a specific view of a list. This extension allows that view of the list to be querried against. The modification is fairly simple instead of calling SPView.RenderAsHtml() we’ll end up calling SPList.RenderAsHtml(SPQuery q). In order to do this you need to insert two lines of code between where we instantiated our view and when we got the html. In the end your two lines will now be four:
SPViewmyView = myList.Views[viewName];
SPQuerymyQuery = new SPQuery(myView);
myQuery.Query = “a CAML query goes here”;
html = myList.RenderAsHtml(myQuery);
Then you just have to replace the string “a CAML query goes here” with an actual CAML query. I should probably also mention that CAML querries can be made simple with U2U’s CAML Builder. Keep in mind that the web part can be further powerful by leveraging class properties.
1 Comment so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Very important info.
Comment by Alex March 25, 2008 @ 6:28 am