[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Persisting properties across posts?

Durk van Veen

3/29/2002 6:07:00 AM

OK, I'm trying to do something that's probably really simple but I cannot
get it to work. Basically I have a mobile control that inherits from the
MMIT control. I'm essentially trying to do the following [this is off the
top of my head so don't try to compile this code ;-) ] :

public class MyControl : System.Web.UI.MobileControls.List
{
private string _privprop;

public string PrivProp
{
get { return _privprop; }
set { _privprop = value; }
}
}


OK, the property is recognized as being valid for the control, but what I'm
really trying to do is change the property permanently. So for instance, if
I initially add the following to a server page:

<cci:MyControl id="myctrl" runat="server" PrivProp="test"></cci:MyControl>

the value of the PrivProp property will be "test". Now when I add a command
button to my form and add code to the Click handler for the button that
changes the property to something else, there's no way I can get the
property to hold it's value:

[from btn1_Click]
myctrl.PrivProp = "newval";

Changing the PrivProp value like this still makes it come out as "test" if I
then query the value of the property on a subsequent submit from another
button:

[from btn2_click]
Label1.Text = myctrl.PrivProp

(assuming there's a label on my form as well)

I'm probably missing something really basic, but it's driving me up the
wall. Any suggestions?

Durk