Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Pass data to asp.net 2.0 web part?

Reply
Thread Tools

Pass data to asp.net 2.0 web part?

 
 
Dave
Guest
Posts: n/a
 
      04-02-2007
I've posted this in the asp.net forum but without any response. I have a
aspx page that I want to pass data into dynamically created
webparts. Each web part will contain a user control I created
(WebUserControl1) that exposes a public property (.TestData). This property
then sets a label control on Web Part's user control....

WebUserControl1 mycontrol =
(WebUserControl1)LoadControl("WebUserControl1.ascx ");
mycontrol .TestData= "test data passed to webpart's usercontrol from .aspx";
mycontrol .ID = "control";

WebPart myWebPart = WebPartManager1.CreateWebPart(mycontrol);
myWebPart.Title = "Some Title";
WebPartManager1.AddWebPart(myWebPart, WebPartManager1.Zones[0], 0);

But when the page renders, the webpart is created in the zone, with the
title and user control, but the data passed seems to get lost and is never
setting the label inside.

What am I doing wrong? Thanks, Dave.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
difference between pass by address and pass by reference!! blufox C Programming 2 04-03-2006 02:53 PM
Pass by reference / pass by value Jerry Java 20 09-09-2005 06:08 PM
Pass by Pointer * or Pass by Reference &? Robert C++ 10 08-24-2005 04:15 PM
pass by ref vs pass by pointer Radde C++ 38 08-23-2005 06:29 PM
Pass-by-reference instead of pass-by-pointer = a bad idea? Mr A C++ 111 07-14-2005 03:04 AM



Advertisments