IDataBindingsAccessor

  • Thread starter Thread starter Ian Frawley
  • Start date Start date
I

Ian Frawley

Anyone know how to use the IDataBindingsAccessor interface>
I am trying to check if a System.Web.UI.WebControls.WebControl that I
generate on the fly has DataBindings
 
Ian,

The IDataBindingsAccessor class is to help with the evaluation of
expressions in ASP.NET for controls. It is not used to indicate that the
control is data bound. Generally speaking, any control can be data bound.
If you want to be notified of when a control is DataBound, then you can
connect to the DataBindings event on the control. This should allow you to
compile a list of those controls that are data bound, for processing later.

Hope this helps.
 
Hi,

Thanks for the response. The reason why I want to check is an object is
alowed databindings is because I am generating lots of objects on the fly
using a Type and casting it to a generic
System.Web.UI.WebControls.WebControl. The problem is that if the object is a
textbox I just want to set the ID on it but if the object is a DropDownList
then I want to set the DataSource etc. If my WebControl is really a TextBox
the HasDataBindings should return false. I am trying to avoid writing a big
switch statement like:

switch(temp.GetType().FullName)
{
case "TextBox":
etc. etc. etc.

Do you know what I mean.

Cheers

Ian
Nicholas Paldino said:
Ian,

The IDataBindingsAccessor class is to help with the evaluation of
expressions in ASP.NET for controls. It is not used to indicate that the
control is data bound. Generally speaking, any control can be data bound.
If you want to be notified of when a control is DataBound, then you can
connect to the DataBindings event on the control. This should allow you to
compile a list of those controls that are data bound, for processing later.

Hope this helps.
 
Back
Top