I have created a custom solution and used listviewwebpart to display the data. It works fine if I have only one webpart added on a page but as soon as I add another webpart the webpart start showing "Loading..." and stuck there.Below is my code for the same. I am taking weburl, list name and view name as an input from the user.
ListViewWebPart lvwp = new ListViewWebPart();
lvwp.ID = this.ID;
lvwp.Visible = true;
lvwp.EnableViewState = true;
SPList list = web.Lists[ListName.ToString()];
lvwp.ListName = list.ID.ToString("B").Trim().ToUpperInvariant();
lvwp.WebId = list.ParentWeb.ID;
lvwp.ListId = list.ID;
if (!string.IsNullOrEmpty(ViewName))
{
SPView defaultView = list.Views[ViewName];
lvwp.ViewId = Int32.Parse(defaultView.BaseViewID);
lvwp.ViewGuid = defaultView.ID.ToString("B").Trim().ToUpperInvariant();
}
lvwp.ChromeState = System.Web.UI.WebControls.WebParts.PartChromeState.Normal;
lvwp.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.None;
lvwp.HelpMode = WebPartHelpMode.Modeless;
this.Controls.Add(lvwp);
Do anyone have any idea why is it happening. Any help is highly appreciated.
Thanks