473,788 Members | 2,828 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.U serControl
{
public string Caption
{
get { return (string)ViewSta te["Caption"]; }
set { ViewState["Caption"] = value; }
}

public void Page_Load(objec t 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 DeclarativeCata logPart:

<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 1151

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

Similar topics

0
1006
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 (I'll post the code at the end of this message). What is the component in vs.net that may be improperly configured/installed that would cause this behavior? Thanks, ~billy
0
1325
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 Page.IsPostback, however, since these controls are loaded AFTER postback, this won't work. I tried using Viewstate, but since I'm swapping multiple controls, I'll
0
1001
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 the page load. One of the cell is the control. The control Response.Writes an img tag. The src for the img tag is "something.img". Now we have a HttpHandler for *.img, the hander reads the image from DB and does a Response.BinaryWrite. Everything...
4
1889
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" webform/page to be reload so the data on it (in repeaters) is reloaded using a new value from the dropdownlist (and which btw is also stored in a session variable for later use). I'm not sure the best way to do this.
1
1114
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" intAreaID="<%=Request.QueryString("lvl2")%>" intStandardID='<%# Container.DataItem("standard_id")%>' Runat="Server"/> <% ElseIf Not(Request.QueryString("lvl3") Is Nothing) Then %> <L:Links ID="LevelThree"
3
2331
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 BarColor2 I can access these properties in the property browser and change the colors. But how to I have those changes persist between design time and run time for
0
856
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 interfaces to use. Some code examples would be very handy. Thanks for help. Uft
3
5479
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 control parameter for some other datasource on a page (outside that user control) with declarative databinding (ie. using the designer, or aspx tag syntax).
2
5058
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
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.