views:

31

answers:

1

I have a custom control in an aspx page that has a property named Size

public int Size
{
     get { return Convert.ToInt32(ViewState["CreativeSize"]); }
     set { ViewState["CreativeSize"] = value; }
}

This property is set in the aspx page to a value lets say 500 during a postback called by a Button control that is in the page (not in the custom control).

I also have a button inside the custom control that raises a postback like this

protected void btnUpload_Click(object sender, EventArgs e)
{
     if (fuBannerfile.HasFile)
         if (fuBannerfile.FileContent.Length / 1024 > this.Size)
             ;//code here not important
}

When this event is called the "this.Size" property is 0. I also noticed during debugging that during Page_Load of the page, if i access the property like this:

int size = customControlId.Size;

the property is set to 500. But after that when the debugger reaches the event inside the control the property is 0.

Any idea why this is happening, or what could be causing it?

A: 

Just found out what the problem is.

I have 5 of the same controls in the same page, and i have set the Size property of the wrong control....

Cant believe i lost 2 hours on this.

Atzoya