Adding Properties to .aspx and .ascx files

Discussion in 'ASP .Net' started by Red, May 9, 2004.

  1. Red

    Red Guest

    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
     
    Red, May 9, 2004
    #1
    1. Advertisements

  2. 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;}
    }


    Red wrote:
    > 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
    >
    >
     
    pubb AT hotmail DOT com, May 9, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Quentin
    Replies:
    1
    Views:
    692
    Quentin
    Jul 29, 2003
  2. Guest
    Replies:
    3
    Views:
    3,470
    mikeb
    Nov 5, 2003
  3. Jason Shohet
    Replies:
    1
    Views:
    651
    Kevin Spencer
    Nov 10, 2003
  4. Holger (David) Wagner
    Replies:
    2
    Views:
    2,152
    Holger (David) Wagner
    Jul 3, 2004
  5. Garth17
    Replies:
    3
    Views:
    3,253
    Brock Allen
    Mar 18, 2005
  6. John M
    Replies:
    1
    Views:
    1,646
    Kumar Reddi
    May 29, 2005
  7. =?Utf-8?B?UGF1bA==?=

    .ASCX files, ASPX files and code behind

    =?Utf-8?B?UGF1bA==?=, Sep 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    7,470
    Michel de Becdelièvre
    Sep 27, 2005
  8. Nathan Sokalski
    Replies:
    1
    Views:
    615
    Nathan Sokalski
    May 15, 2007
Loading...