Last post Mar 26, 2010 12:07 PM by vgrigor4
Mar 23, 2010 06:40 AM|vgrigor4|LINK
I created custom ForeignKeyCustom_EditField filed edit templte.
In OnDataBinding() method I have acces to current row and can fill currrent control
with any values.
But I need to change thos values when other combobox is selected some value.
for this I made current dropdown control as autopostback = true;
to detect event of something changed in form.
But when I need to change this values according choice in else field
I have not way to do it once I can not access this values once OnDataBinding() is not called any more
and I have no access to current row.
my question is - can I extract dynamic control values from current page knowing their field names
in a Page_Load() or like this handler when postback happens?
Mar 23, 2010 08:16 AM|renjithrajan88|LINK
it is possible to get the values from the dynamic controls. but are u using any dynamic controls here?
Mar 23, 2010 08:37 AM|sjnaughton|LINK
hI Vgrigor4, have a look at your other post
Re: need to change... as this seems to be a duplicate.
Mar 24, 2010 12:39 PM|vgrigor4|LINK
Your code helped me much, but this (really great) sample code now is not working in Studio 2010 RC when I copy-pasted it to new project.
one thing I can not resolve:
programmatically adding events to found template field control is not working,
as well even if add event to DropDown control from template itself when I have direct access to it.
But if I add event subscription code in aspx template page - event begin work,
if I enable autopostback for that control.
(this method I use for now once else not working)
what do you think about reason of it?
Mar 24, 2010 01:18 PM|sjnaughton|LINK
Hi Vgrigor4, I've not made a sample foe DD4 yet sorry, are you using EntityFramework or Linq to SQL?
Dynamic Data 4
Mar 25, 2010 03:40 AM|vgrigor4|LINK
I use only Linq to SQL .
As well one more problem - If I iterate over all controls to get last values, it working good but
except for last changed control.
some most last change is not visible at postback.
This value can be passed directly from that changed control to dependee control where we want have this value refleced.
Mar 25, 2010 08:04 PM|sjnaughton|LINK
Hi Vgrigor, you always need to apply column ordering for this tecnique to work as the child must always come after the parent in order for the child to be able to see the parent after it is instantiated.
Mar 26, 2010 12:07 PM|vgrigor4|LINK
I can not post on your blog due to my company local policy, so I ask there.
for the call
In sample code parent control has type <DetailsView>
but for standard routing will work
and for gridView editing will work
so question is - how to define within FieldTemplate which parent type it have?