Question

I've 2 FormPanelFor definitions:

.Items
(
x.FormPanelFor(m => m.SelectedSection).ID("selectedSection"),
x.FormPanelFor(m => m.SelectedGroup).ID("selectedGroup")
)

And have model definitions:

public class Model_Section
{
    [Field(FieldLabel = "Section Name", AllowBlank = false)]
    public string Name { get; set; }

     .....
 }

public class Model_Group
{
    [Field(FieldLabel = "Group Name", AllowBlank = false)]
    public string Name { get; set; }

     .....
 }

they both have "Name" property in common and as a result i got this error:

A Control with an ID of "App.Name" has already been initialized. Please ensure that all Controls have a unique id. The following Control has the same ID as at least one other Control on the Page. All Controls must have a unique ID. Control Details ID: Name. ClientID: App.Name Type: TextField Parent Control Details ID: selectedGroup ClientID: App.selectedGroup Type: FormPanel

how can i fix this?

Was it helpful?

Solution

The workaround for this issue would be providing the prefix for form fields manually:

.Items
(
x.FormPanelFor(m => m.SelectedSection, htmlFieldName: "SelectedSection").ID("selectedSection"),
x.FormPanelFor(m => m.SelectedGroup, htmlFieldName: "SelectedGroup").ID("selectedGroup")
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top