Override design time databind settings of label WebControl at runtime ?

Discussion in 'ASP .Net' started by Martin, Jun 21, 2004.

  1. Martin

    Martin Guest

    Hi,

    I've got a web label control which I set a databind expression on the Text
    attribute in the html for the page (aspx file).

    At runtime, I want to override this attribute, so before I do
    MyLabel.databind() (or actually Page.DataBind()), I set Text to "".
    This doesn't work because then the databind comes along and redefines the
    Text attribute.

    Then I tried removing this control from the Page before doing my
    Page.DataBind(). However it still does the databind!!!!!!!!!!!!!!
    Can I only dynamically remove controls that I've added dynamically?

    Why else is this failing?

    Given that I want the default databinding defined in the html for my page,
    how should I stop the databinding in non-default situations?
    I have loads of controls on the page, so don't want to databind each one (or
    not) individually.

    TIA
    Martin
     
    Martin, Jun 21, 2004
    #1
    1. Advertising

  2. Martin

    Natty Gur Guest

    Hi,

    You can remove "static" controls from form :
    this.FindControl("Form1").Controls.Remove(this.FindControl("Label1"));




    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)52-8888377


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 22, 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. CSharpner
    Replies:
    0
    Views:
    1,044
    CSharpner
    Apr 9, 2007
  2. donet programmer
    Replies:
    3
    Views:
    1,551
    Gregory A. Beamer
    Nov 20, 2009
  3. Michael
    Replies:
    0
    Views:
    225
    Michael
    Dec 29, 2003
  4. SteveC

    Override DataBind of Checkbox?

    SteveC, Sep 9, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    145
    SteveC
    Sep 9, 2003
  5. Knut Krueger
    Replies:
    8
    Views:
    278
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page