471,056 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

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 1448

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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.