473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

User control in web part properties not initialized when added via catalogpart

I'm not sure what I'm doing wrong here...
I've created a web parts zone, and a catalog zone.

Now if I create a very simple user control called "Tester":

public partial class Tester : System.Web.UI.UserControl
{
public string Caption
{
get { return (string)ViewState["Caption"]; }
set { ViewState["Caption"] = value; }
}

public void Page_Load(object sender, EventArgs e)
{
Label1.Text = Caption;
}
}
, I can place this in my WebPartZone, add a 'Caption="Hello"'
attribute, and it shows up fine with the caption displayed correctly.

However, if I add it to a DeclarativeCatalogPart:

<uc1:Tester ID="mytester" runat="server" EnableViewState="true"
Title="MyTester" Caption="Hello" />

, then I add the part to the zone, the part is added, but the caption
does not appear. A closer inspection reveals that although Page_Load is
entered, Caption is null (and ViewState for the control is empty). This
seems to be because clicking "add" in the CatalogZone adds the user
control with a new control id "wpxxxxx", and this new control is not
instantiated.

Do I need to do anything special to get the catalogzone to instantiate
a new instance of my control properly, setting up all my properties?

Any help would be much appreciated!

Jun 17 '06 #1
0 1137

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: billy | last post by:
I'm using vs.net 2005 beta (July distribution). I'm having problems getting my control's properties (i.e property int PropertyTest int get(); set(int)} and what I don't I'm doing anything wrong...
0
by: Lucas Tam | last post by:
Hi all, I am dynamically loading user controls after a postback. Within the User Control, how do I check if it is being loaded for the first time? With a regular ASPX page I can check If Not...
0
by: Manikkoth | last post by:
Hello, We are using a user control and a HttpHandler to display an image in a grid. The images are stored in a RDBMS. Here is the approach that we use in brief. The cells are added to the grid in...
4
by: Matt Jensen | last post by:
Howdy all Been searching and can't find a good answer to my problem. I've got a usercontrol 'banner' at the top of my page, and when the selection in the dropdown list changes I want the "host"...
1
by: Adam Knight | last post by:
Hi all, I have just tried to assign the properties of a user control dynamically in the following way: <% If Not(Request.QueryString("lvl2") Is Nothing) Then %> <L:Links ID="LevelTwo"...
3
by: Steve Long | last post by:
Hello. Can anyone tell me the proper way to save the properties of a user control between design time and run time? So, I've got this user control with the following properties: BarColor1...
0
by: Eric | last post by:
Hello. Is it possible to make Web User Control displaying all the properties just like built-in controls? Can I make it to be placeable and moveable like f.ex. div or panel? If yes - how? What...
3
by: HP | last post by:
Hi there I've asked about it few times, and seen it asked more times, but no one ever replied. The question is: is it possible to use a control inside of user control (eg. dropdownlist) as a...
2
by: Max2006 | last post by:
Hi, I have a user control with a public property like this: public string Text { get { return cboCountry.Text; } set { cboCountry.Text = value; } }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.