468,315 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

Override design time databind settings of label WebControl at runtime ?


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.

Nov 18 '05 #1
1 1388

You can remove "static" controls from form :
this.FindControl("Form1").Controls.Remove(this.Fin dControl("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!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marty McDonald | last post: by
12 posts views Thread by Raed Sawalha | last post: by
3 posts views Thread by Christian Filzwieser | last post: by
4 posts views Thread by Christian Hofmann | last post: by
reply views Thread by Brant Estes | last post: by
5 posts views Thread by Mr Not So Know It All | last post: by
10 posts views Thread by Allan Ebdrup | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.