Honestly I can't imagine an application that wouldn't need immediate updating. I suppose if you had a database with no relations, but what real world app has that?
I too have a hard time understanding how this got out the door as part of the preview. It took me 20 minutes of messing around with this thing to find the problem.
Sometimes the most obvious of things ellude us the most. Fortunately, I think we have been able to come up with a working solution to the problem. You will need to edit make changes to 2 files: FilterUserControl.ascx and ForeignKey_Edit.ascx. This solution
uses C# (sorry, no VB for now) and should work the same for both inline and code-behind versions.
For ForeignKey_Edit.ascx
In the Page_Load method, replace the following line of code
In the Page_Init method, replace the following line of code
DropDownList1.DataSource = DataSource;
with this
var foreignKeyColumn = DynamicDatabase.TheDatabase.GetMetaTable(this.TableName).FindColumn(this.DataField) as DynamicMetaForeignKeyMember;
if (foreignKeyColumn != null) {
// only kick in if we are dealing with a foreign key column
DropDownList1.DataSource = foreignKeyColumn.ParentMetaTable.DataContextProperty.GetValue(Activator.CreateInstance(DynamicDatabase.TheDatabase.CreateDataContext().GetType()), null);
}
else {
DropDownList1.DataSource = DataSource;
}
The workaround is a bit ugly but it should work. Let us know if you experience more issues. Once we are able to verify that this fix works we will post updated versions of the relevant files.
Excellent Marcin! That did it. Both the filter and edit dropdowns are now updating as expected.
I'm really pretty impressed by the Dynamic Data stuff. It seems like for years different frameworks and controls promised this sort of out of the box functionality but none managed to actually provide it.
From what I've seen of Dynamic Data so far it really delivers where previous attempts have failed. I think it really has the potential to get me 40% of my 80% (in the 80-20 rule) in about 10% of the time. Calculate that out and it's pretty great. Take
my word for it.
Yes, awesome, thank you for the fix. One note though, in the FIlterUserControl.ascx, there isn't a Page_Load function, you are using the Page_Init function instead. I really love the out of the box functionality of dynamic data. It makes the develoment
time of data sites so much faster. Even with the customizations I've added, it still cut the development time by at least 75%. Thank you guys so much for this set of tools.
stevekain
Member
20 Points
16 Posts
Re: Dropdowns not updating correctly
Dec 20, 2007 04:11 PM|LINK
Honestly I can't imagine an application that wouldn't need immediate updating. I suppose if you had a database with no relations, but what real world app has that?
I too have a hard time understanding how this got out the door as part of the preview. It took me 20 minutes of messing around with this thing to find the problem.
marcind
Contributor
3344 Points
609 Posts
Microsoft
Re: Dropdowns not updating correctly
Dec 20, 2007 06:30 PM|LINK
Sometimes the most obvious of things ellude us the most. Fortunately, I think we have been able to come up with a working solution to the problem. You will need to edit make changes to 2 files: FilterUserControl.ascx and ForeignKey_Edit.ascx. This solution uses C# (sorry, no VB for now) and should work the same for both inline and code-behind versions.
For ForeignKey_Edit.ascx
In the Page_Load method, replace the following line of code
with this
For FilterUserControl.ascx
In the Page_Init method, replace the following line of code
with this
The workaround is a bit ugly but it should work. Let us know if you experience more issues. Once we are able to verify that this fix works we will post updated versions of the relevant files.
ASP.NET Team
@marcind
Blog
stevekain
Member
20 Points
16 Posts
Re: Dropdowns not updating correctly
Dec 20, 2007 06:42 PM|LINK
Excellent Marcin! That did it. Both the filter and edit dropdowns are now updating as expected.
I'm really pretty impressed by the Dynamic Data stuff. It seems like for years different frameworks and controls promised this sort of out of the box functionality but none managed to actually provide it.
From what I've seen of Dynamic Data so far it really delivers where previous attempts have failed. I think it really has the potential to get me 40% of my 80% (in the 80-20 rule) in about 10% of the time. Calculate that out and it's pretty great. Take my word for it.
Thanks again.
ron.westbroo...
Member
45 Points
19 Posts
Re: Dropdowns not updating correctly
Dec 20, 2007 07:04 PM|LINK
Yes, awesome, thank you for the fix. One note though, in the FIlterUserControl.ascx, there isn't a Page_Load function, you are using the Page_Init function instead. I really love the out of the box functionality of dynamic data. It makes the develoment time of data sites so much faster. Even with the customizations I've added, it still cut the development time by at least 75%. Thank you guys so much for this set of tools.
Software Engineer
Avanade, Inc.
marcind
Contributor
3344 Points
609 Posts
Microsoft
Re: Dropdowns not updating correctly
Dec 20, 2007 07:11 PM|LINK
Thanks Ron,
I've updated the fix instructions. I am glad you are finiding Dynamic Data useful.
ASP.NET Team
@marcind
Blog
marcind
Contributor
3344 Points
609 Posts
Microsoft
Re: Dropdowns not updating correctly
Dec 20, 2007 10:44 PM|LINK
I have also placed a zip file with the modified files that you can simply unzip into your Dynamic Data project on my blog.
ASP.NET Team
@marcind
Blog