KevinGallagher
Programmer
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
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