Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Listview web part in custom web part

  Asked By: Lacy    Date: Jan 21    Category: Sharepoint    Views: 3892

I am developing a custom web part in which i have to display data from already
existing link web part. I used an ListViewWebPart for the purpose, in which am
facing some problems.

1) The data of links web part does not get displayed if I give view type as
html. But is rendered correctly if the view type is Chart/Grid.
2) I cannot add the listview webpart to web part collection as the code is
inside another custom web part.

Dim spWebPartCollection As SPWebPartCollection
Dim links_web_part As New ListViewWebPart
Dim guid As Guid
Dim spsite As New SPSite(http://xyz:portNumber)
Dim spweb As SPWeb = spsite.OpenWeb()
Dim splist As SPList = spweb.Lists("links_web_part")
links_web_part.ListName = splist.ID.ToString("B").ToUpper()
spweb = SPControl.GetContextSite(Context).OpenWeb()
links_web_part.ViewGuid = splist.DefaultView.ID.ToString("B").ToUpper()
links_web_part.EnableViewState = True
links_web_part.ViewType = ViewType.Html
links_web_part.RenderControl(output)

Any idea of what the problem can be??? I know for sure that the links are
being retrieved.. but how do I display them in web part?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Listview web part in custom web part Or get search suggestion and latest updates.




Tagged: