I
Ian
I have sub-classed the Page class in order to provide some base
properties and methods that every page on my site will need access to.
I would like to have these things show up in the Simple Binding
window of the DataBindings dialog. I then found this site
(http://msdn.microsoft.com/library/d.../vsintro7/html/vxurfDataBindingsDialogBox.asp)
which says:
The tree view displays these objects: the Page object; any data source
that derives from the Component class; any objects instantiated in the
page's InitializeComponent method; and any objects that implement the
IEnumerable interface.
So I decided to try to make my objects show up there. Ok, so the
items I wasnted to bind to were already properties of my subclass of
the Page object and they werent showing up, so I decided to try making
a component. I made a new component class and made it a property of
my Page subclass. It didnt show up. I tried instantiating it in an
InitializeComponent method, but this didnt work either and I suspect
that this is somehow tied to being the last class in the inheritance
hierarchy before the parser-generated class. Since the data I want to
expose isn't multi-row, making it IEnumerable doesnt really make much
sense.
For instance, I'd like people to be able to bind to the user's login
name. So I'd like to add a property to my page sub-class:
public string UserName
{ get { return Context.User.Identity.Name; } }
I'd really like to make my properties/objects show up in the simple
binding tree because I'm trying to make it as easy as possible to make
pages based on my inherited base class, and, for better or for worse,
having to type manual binding expressions is probably going to be too
difficult for my "authoring" user base.
The only things I've ever seen in this pane are the Page object
(effectively useless) and the DataSet. I cant see that these two
classes share any attributes that would flag them for inclusion. I'm
assuming that somehow their designers are Siting them in the WebForms
designer's container, but this all appears to be happenning behind the
scenes and the Design namespaces are still woefully under-documented.
Can anyone clear this up? or offer other suggestions for making my
properties show up there?
Ian
properties and methods that every page on my site will need access to.
I would like to have these things show up in the Simple Binding
window of the DataBindings dialog. I then found this site
(http://msdn.microsoft.com/library/d.../vsintro7/html/vxurfDataBindingsDialogBox.asp)
which says:
The tree view displays these objects: the Page object; any data source
that derives from the Component class; any objects instantiated in the
page's InitializeComponent method; and any objects that implement the
IEnumerable interface.
So I decided to try to make my objects show up there. Ok, so the
items I wasnted to bind to were already properties of my subclass of
the Page object and they werent showing up, so I decided to try making
a component. I made a new component class and made it a property of
my Page subclass. It didnt show up. I tried instantiating it in an
InitializeComponent method, but this didnt work either and I suspect
that this is somehow tied to being the last class in the inheritance
hierarchy before the parser-generated class. Since the data I want to
expose isn't multi-row, making it IEnumerable doesnt really make much
sense.
For instance, I'd like people to be able to bind to the user's login
name. So I'd like to add a property to my page sub-class:
public string UserName
{ get { return Context.User.Identity.Name; } }
I'd really like to make my properties/objects show up in the simple
binding tree because I'm trying to make it as easy as possible to make
pages based on my inherited base class, and, for better or for worse,
having to type manual binding expressions is probably going to be too
difficult for my "authoring" user base.
The only things I've ever seen in this pane are the Page object
(effectively useless) and the DataSet. I cant see that these two
classes share any attributes that would flag them for inclusion. I'm
assuming that somehow their designers are Siting them in the WebForms
designer's container, but this all appears to be happenning behind the
scenes and the Design namespaces are still woefully under-documented.
Can anyone clear this up? or offer other suggestions for making my
properties show up there?
Ian