I have to display a view of a list, from the root web, in sus sites. I used the XsltListViewWebPart by adding the webpart in the galery of webparts by using SharePoint Designer (*).
This method doesn't work correctly, because i had to create sub sites using a template, where i inserted my XsltListViewWebPar. However, when i create a new site the view of my list is not the one i selected :(
So i decided to develop my own WebPart and use the RenderAsHtml method of my specific view. Every think was working correctly exept the sorting and filtering features and the contextual menu of items.
it shows the following message :
To solve that i found that i used to make this code :
SPList list = web.Lists[_list];
SPView viewInProgress = list.Views[_view];
String S = viewInProgress.RenderAsHtml();
String patern = "OnClick='javascript:SubmitFormPost\\(\".*\\?";
String substitution = "OnClick='javascript:SubmitFormPost(\"" + SPContext.Current.Site.RootWeb.Url + "?";
S = Regex.Replace(S, patern, substitution);
writer.Write(viewInProgress.RenderAsHtml());
The problem was that the list wasn't in the same SPWeb.
Now, only the contextual menu isn't working ... I am working on ;)
This method doesn't work correctly, because i had to create sub sites using a template, where i inserted my XsltListViewWebPar. However, when i create a new site the view of my list is not the one i selected :(
So i decided to develop my own WebPart and use the RenderAsHtml method of my specific view. Every think was working correctly exept the sorting and filtering features and the contextual menu of items.
it shows the following message :
To solve that i found that i used to make this code :
SPList list = web.Lists[_list];
SPView viewInProgress = list.Views[_view];
String S = viewInProgress.RenderAsHtml();
String patern = "OnClick='javascript:SubmitFormPost\\(\".*\\?";
String substitution = "OnClick='javascript:SubmitFormPost(\"" + SPContext.Current.Site.RootWeb.Url + "?";
S = Regex.Replace(S, patern, substitution);
writer.Write(viewInProgress.RenderAsHtml());
The problem was that the list wasn't in the same SPWeb.
Now, only the contextual menu isn't working ... I am working on ;)

Hi, is the Context menu working now ?
ReplyDeleteThanks,
San