3

I was customizing list view web parts to meet our reqs. What I did was:

  • Instantiate ListViewWebPart in another web part
  • Set web (reflection), webid and list id
  • add ListViewWebPart to Controls collection of web part

However there are few discrepancies in behavior of standart list view web part and our web part

  • paging not working
  • if i add 2 or more web parts on the same page and on one apply the filter/sorting this is also populated to other web parts on the page. If the web part list does not contain the field it fails to render.

Anyone met with this behavior?

Thanks

4
  • Are you talking about ListViewWebPart, or about XsltListViewWebpart? ListViewWebPart is old 2007-style web part, SharePoint 2010 uses XsltListViewWebPart to render list views, try to use it. Commented Mar 5, 2013 at 7:45
  • hi, thanks. i am using ListViewWebPart. Well if I use XsltListViewWebPart the ECB menu is not working well. It renders, however I select one menu item I got error. But will try it
    – Ivan
    Commented Mar 5, 2013 at 7:56
  • Hi. Do you add any custom controls or custom created asp controls? Commented Mar 5, 2013 at 8:12
  • Hi. No. just add ListViewWebPart to our web part Controls collection.
    – Ivan
    Commented Mar 5, 2013 at 8:16

2 Answers 2

1

I've seen this problem before, on a Document Set homepage. The problem is that each webpart renders its own context object in DOM of the page, to be used in various javascript functions like sorting, paging, and also setting the ribbon.

Despite extensive investigation the best answer I can give you is that you need to decide which of the webparts is most important, and work from that.

What you then can do is to make the other webpart not rendering its context by specifying the NoCTX parameter in the view documented (somewhat) here.

OR. as a workaround that will only work in 2010, you can add the most important webpart to the end of the page, making its context the one used in javascript function. But that means that the other webpart will still break on sorting and filtering.

0

Try explicitly specifying the View in the ListViewWebPart. This is something I have done before in the past (wrapped that web part in another web part, by adding it to the Controls collection in CreateChildControls). I think this scenario only really works best if you leave it at one instance on a page though - unless you allow for specifying the List and View of the web part.

1

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.