Adding Properties to .aspx and .ascx files

  • Thread starter Thread starter Red
  • Start date Start date
R

Red

I am considering adding some properties to my user conttrol and web forms
how ever I am not sure if this will work. The web control I am using fill a
data grid for a specific invoice. I would like to add a property to the web
control so that I can use this invoice number in oth operations of the
control.

Will this property "Survive" a post back?

Do I have to add view state code to keep the properties set through multiple
post packs??

Thanks in advance.

Red
 
To answer your first question, it depends on how you implement the
property :) If you use private fields, then the answer is no. I think
this is what you're looking for.

private int InvoiceNumber
{
get{return (int)ViewState["InvoiceNumber"];}
set{ViewState["InvoiceNumber"] = value;}
}
 
Back
Top