Determining control behaviour at design-time/run-time

Discussion in 'ASP .Net' started by Paul Cook, Nov 6, 2003.

  1. Paul Cook

    Paul Cook Guest

    Hi

    I am trying to determine whether a control is being displayed at
    designtime or runtime but this piece of code doesn't seem to work
    correctly. Note that this is not a web user control (ascx) although
    this control does end up being used on an ascx control.

    The expression always evaluates false (the else part - runtime!)

    public class AccountDropDownList :
    System.Web.UI.WebControls.DropDownList
    {
    public AccountDropDownList()
    {
    if(Site != null && Site.DesignMode)
    {
    this.Items.Add(new ListItem("Design time"));
    }
    else
    {
    this.Items.Add(new ListItem("Run time"));
    }
    }
    }

    Any help would be greatly appreciated, Paul.
     
    Paul Cook, Nov 6, 2003
    #1
    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. Replies:
    0
    Views:
    722
  2. Tzury Bar Yochay
    Replies:
    3
    Views:
    490
    Jacob Yang [MSFT]
    Nov 29, 2003
  3. =?Utf-8?B?cmtibmFpcg==?=

    Design Time vs Run Time DataGrid

    =?Utf-8?B?cmtibmFpcg==?=, Feb 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    597
    Karl Seguin
    Feb 1, 2005
  4. Pierre Yves
    Replies:
    2
    Views:
    487
    Pierre Yves
    Jan 10, 2008
  5. Alfonso
    Replies:
    2
    Views:
    100
    Alfonso
    Dec 1, 2006
Loading...

Share This Page