Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 15, 2012 10:51 AM by sjnaughton
Jan 14, 2012 03:25 PM|LINK
Does anyone know if there is a way to set the SelectedValue of a drop down on the insert template? I would need to do this at run time.
The situation is that for certain non-priveleged users, they can only insert rows for a selected drop down field. So, for those users I would want to set the SelectedValue and make the field Readonly. For priveleged users, they would be able to select
anything for that field.
Thanks for your help!
Jan 14, 2012 03:30 PM|LINK
Jan 14, 2012 05:41 PM|LINK
Thanks for your suggestion, can I ask which markup are you talking about? I think I could make it work by changing ForeignKey_Edit.ascx.cs. It's a bit of a hack, but i'm not that pure:)
Jan 14, 2012 05:57 PM|LINK
Jan 15, 2012 10:51 AM|LINK
I am assuming this is DD for .Net 4 if so look at the Insert page template codfe behind it creates a collection
protected void Page_Init(object sender, EventArgs e)
table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
DetailsDataSource.EntityTypeFilter = table.EntityType.Name;
you will notice the table.GetColumnValuesFromRoute(Context)) this getts any values from the route but if you pass it to a local variable first you can manually add you own default values as it is a collection of type IDictionary<string, object> then pass
the updated dictionary into the SetMetaTable extension method.