Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sharepoint web part problem

Status
Not open for further replies.

KevinGallagher

Programmer
Feb 24, 2005
1
GB
I am using Visual Studio to write a web part for Sharepoint Portal. It is a simple web part that consumes a web service and renders the results as a datagrid. I can get it working untill I set the datasource. Both Visual Studio and Sharepoint are on the same machine. If I comment out all the code relating to the web service I can get it to work simply rendering text. The error generated when I drop the web part into a web part zone is thus: The "myWebPart" Web Part appears to be causing a problem. The code below shows what I am trying to do. Any advice on how to do this would be much appreciated as I have recently been charged with writing web services/parts for Sharepoint.

Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
output.Write(SPEncode.HtmlEncode([Text]))

Dim myLabel As New Label
myLabel.Text = "Input from Kev......!"

Dim dataGrid1 As New DataGrid
Dim wsProxy As New hb.TheHolyBible
dataGrid1.DataSource = wsProxy.ListBooks
dataGrid1.DataBind()

Me.Controls.Add(myLabel)
Me.Controls.Add(dataGrid1)

myLabel.RenderControl(output)
dataGrid1.RenderControl(output)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top