|
Prev: intellisense and javascript
Next: Get session cookies from webrequest and pass then to new request
From: joer.banno on 3 Jul 2008 06:36 Hi I have a table with 2 columns, one column is a Catalogpartzone and another a webpartzone: I have a UserControl which only contains a label, this label has a public property. private string _SmurfText; [Personalizable(PersonalizationScope.User)] public string SmurfText { get { return this._SmurfText; } set { this._SmurfText = value; } } This property is checked on page_load event and if it has been set it will display the value in the label, else it will display a default value in the label. protected void Page_Load(object sender, EventArgs e) { if (this.SmurfText != null) { this.SmurfMe.Text = this.SmurfText; } else { this.SmurfMe.Text = "Text not set!"; } } The label is added to Declarative part of the catalog zone with a value for the public property,. <asp:DeclarativeCatalogPart ID="Declarative1" runat="server"> <WebPartsTemplate> <LabelSmurf:LabelSmurf id="RedSmurf" runat="server" visible="true" SmurfText="RedSmurf"/> </WebPartsTemplate> </asp:DeclarativeCatalogPart> now when i Add the userwebpart in catalog mode to the webpartzone, the default text shows, when I add another the new one shows a default text and the first one added shows the actual value set in the usercontrol. How can I pass the value to the usercontrol so that it will be set the first time, and not on later requests?
|
Pages: 1 Prev: intellisense and javascript Next: Get session cookies from webrequest and pass then to new request |