PC Review


Reply
Thread Tools Rate Thread

adding webparts during runtime. Problem !

 
 
ton
Guest
Posts: n/a
 
      20th May 2010
Hi,

I want to add a table to a form, within the table 3 rows, 3 columns (as a
default) and within each cell a webpart. This works ok:

For i = 1 To aantalY
r = New TableRow
For j = 1 To aantalX
c = New TableCell
c.BorderStyle = BorderStyle.Solid
c.BorderWidth = 1
c.Height = 100
c.BorderColor = Drawing.Color.Black
w = New WebPartZone
w.ID = "web" & i & "_" & j
If bNieuw Then
UC = New WebUserControl
UC.ID = "uc" & i & "_" & j
w.Controls.Add(UC) ''''''''' THIS LINE
receiveses the ERROR
End If

c.Controls.Add(w)
r.Cells.Add(c)
Next
Table1.Rows.Add(r)
Next


except that if bNieuw=True the usercontrol cannot be added. I receive

System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="System.Web.UI.WebControls.WebParts.WebPartZone staat geen
onderliggende besturingselementen toe."
Source="System.Web"
StackTrace:
bij System.Web.UI.EmptyControlCollection.ThrowNotSupportedException()
bij System.Web.UI.EmptyControlCollection.Add(Control child)
bij _Default.CreateBasetable() in
C:\vb300\Web\CompassNET\Default.aspx.vb:regel 112
bij _Default.Page_Init(Object sender, EventArgs e) in
C:\vb300\Web\CompassNET\Default.aspx.vb:regel 49
bij System.Web.UI.Control.OnInit(EventArgs e)
bij System.Web.UI.Page.OnInit(EventArgs e)
bij System.Web.UI.Control.InitRecursive(Control namingContainer)
bij System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:



can anyone help her ?
Thanx


ton

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Webparts - Ajax.net = You must enable Web Parts by adding a ScriptManager to your page Ryan Microsoft ASP .NET 0 16th May 2007 07:15 PM
Adding WebParts via code behind? Bart Van Hemelen Microsoft ASP .NET 3 5th Sep 2006 09:25 AM
adding webparts from frontpage(virtual server gallery) =?Utf-8?B?S05MTiBSYXZpIFNoYW5rYXI=?= Microsoft Frontpage 1 17th Nov 2005 10:21 AM
webparts runtime error =?Utf-8?B?UlJhdmlwYXRp?= Microsoft ASP .NET 0 8th Nov 2005 12:31 AM
Programmatic adding of WebParts Paal Berggreen Microsoft ASP .NET 2 1st Jun 2005 08:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:59 AM.