P
Pete Hurst
Hi,
Working on my first commercial project with Dynamic Data Entities I've run
into a fairly major problem.
My admin area is scaffolded and inserts/updates are working fine. I'm now
trying to create the actual pages of the website to display data to the
public.
Firstly, I'm not sure if I'm going about this the right way, but there are
no examples out there of how to do this. All the tutorials and documentation
surrounding Dynamic Data simply show you how to scaffold and customise your
tables. I've found so few examples of how to actually start building the
rest of the site (whilst still taking advantage of DD) and those I have seen
have been simple to the point of laughability. So, if there is an easier way
I could achieve this, or if I am not following best practise, please let me
know!
I'm trying to set up a route which looks like: ~/Customers/{name}.aspx
I then want to use value of the {name} token to filter my Customers table
and display details of that customer.
The only way I found to achieve this, was in an IRouteHandler to instantiate
the correct page and pass in the token. Then in my page class I manually add
a Parameter to the WhereParameters collection of an EntityDataSource. This
is working fine, but seems like a horrifically ugly way of acheiving
something that should be easy.
Here is where my problem occurs. My Customer object has a Logo property,
which is a (nullable) foreign key association to an Images table. I've added
a UIHint to this property to use a FieldTemplate called "Image". This works
fine when editing a Customer in my scaffolding. However when I render the
Logo field in a ListView using a DynamicControl, it doesn't work. The
FieldValue property of my FieldTemplateUserControl is null, where normally
it would contain an Image business object! (I stated the foreign key is
nullable and non-enforced, however in this case the database field is not
null and has a valid ID)
I've tried removing the UIHint to check if it was a problem with my field
template, and no - the default ForeignKey field template that is used by
Dynamic Data also fails to render.
I've tried adding a DynamicDataManager to the page, with
AutoLoadForeignKeys="true", and then used
DynamicDataManager1.RegisterControl(CustomerListView), but this still
doesn't solve the problem.
Is this a problem with DDE or am I missing something obvious?
Thanks in advance,
Pete Hurst
Working on my first commercial project with Dynamic Data Entities I've run
into a fairly major problem.
My admin area is scaffolded and inserts/updates are working fine. I'm now
trying to create the actual pages of the website to display data to the
public.
Firstly, I'm not sure if I'm going about this the right way, but there are
no examples out there of how to do this. All the tutorials and documentation
surrounding Dynamic Data simply show you how to scaffold and customise your
tables. I've found so few examples of how to actually start building the
rest of the site (whilst still taking advantage of DD) and those I have seen
have been simple to the point of laughability. So, if there is an easier way
I could achieve this, or if I am not following best practise, please let me
know!
I'm trying to set up a route which looks like: ~/Customers/{name}.aspx
I then want to use value of the {name} token to filter my Customers table
and display details of that customer.
The only way I found to achieve this, was in an IRouteHandler to instantiate
the correct page and pass in the token. Then in my page class I manually add
a Parameter to the WhereParameters collection of an EntityDataSource. This
is working fine, but seems like a horrifically ugly way of acheiving
something that should be easy.
Here is where my problem occurs. My Customer object has a Logo property,
which is a (nullable) foreign key association to an Images table. I've added
a UIHint to this property to use a FieldTemplate called "Image". This works
fine when editing a Customer in my scaffolding. However when I render the
Logo field in a ListView using a DynamicControl, it doesn't work. The
FieldValue property of my FieldTemplateUserControl is null, where normally
it would contain an Image business object! (I stated the foreign key is
nullable and non-enforced, however in this case the database field is not
null and has a valid ID)
I've tried removing the UIHint to check if it was a problem with my field
template, and no - the default ForeignKey field template that is used by
Dynamic Data also fails to render.
I've tried adding a DynamicDataManager to the page, with
AutoLoadForeignKeys="true", and then used
DynamicDataManager1.RegisterControl(CustomerListView), but this still
doesn't solve the problem.
Is this a problem with DDE or am I missing something obvious?
Thanks in advance,
Pete Hurst