I have the following problem:
the default DetailView is ReadOnly, and I need the ASPxObjectPropertyEditor to use another detailview, Child_DetailView_Editable instead.
How can I choose the DetailView to be used together by the ASPxObjectPropertyEditor ?
Thanks,
Costel.
How to change ASPxObjectPropertyEditor's DetailView
Answers
Hello Costel,
As I see, you've already asked this question: ID Q201385 (Choose DetailView for DetailView PropertyEditor reference link). If you've encountered with some difficulties while implementing the custom ProeprtyEditor, please describe them, and we'll help you resolve them. Also, there is another solution to this task - you can create a ViewController with the following code:
C#public class ViewController1 : ViewController {
public ViewController1() {
TargetViewId = "BO_Parent_DetailView";
}
protected override void OnActivated() {
base.OnActivated();
Application.DetailViewCreating += new EventHandler<DetailViewCreatingEventArgs>(Application_DetailViewCreating);
}
void Application_DetailViewCreating(object sender, DetailViewCreatingEventArgs e) {
if (e.ViewID == "BO_Child_DetailView"){
e.ViewID = "BO_Child_DetailView_Editable";
}
}
protected override void OnDeactivating() {
base.OnDeactivating();
Application.DetailViewCreating -= new EventHandler<DetailViewCreatingEventArgs>(Application_DetailViewCreating);
}
}
See also: XafApplication.DetailViewCreating Event
Thanks,
Anatol
Hello Anatol,
Your idea was brilliant. No more need for a custom propertyeditor as stated in http://www.devexpress.com/Support/Center/p/Q201385.aspx .
I simply have this method
void Application_DetailViewCreating(object sender, DetailViewCreatingEventArgs e)
{
e.ViewID = DetailViewInterlinking.getDetailViewID(View.Id, e.ViewID);
}
and a dictionary of ViewIDs so I know how to redirect from what DetailView to what DetailView.
I still think that this should be implemented in XAF, and maybe DetailViewInterlinking.getDetailViewID method would look for an attribute inside the model to see which detailview to redirect to.
Many thanks,
Costel.
Hello Costel,
I apologize for the delay.
These days we've been a little bit overloaded with support queries.
We are working on your issue, and will answer you ASAP.
Thanks,
Anatol