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. Advertising

  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. Advertising

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. Holger (David) Wagner
    Replies:
    2
    Views:
    1,967
    Holger (David) Wagner
    Jul 3, 2004
  2. Garth17
    Replies:
    3
    Views:
    3,065
    Brock Allen
    Mar 18, 2005
  3. John M
    Replies:
    1
    Views:
    1,257
    Kumar Reddi
    May 29, 2005
  4. =?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,239
    Michel de Becdelièvre
    Sep 27, 2005
  5. Nathan Sokalski
    Replies:
    1
    Views:
    529
    Nathan Sokalski
    May 15, 2007
Loading...

Share This Page