Module Edit binding Page template keeps showing "No object type Selected"

Mani SJ asked on February 7, 2020 05:45

https://devnet.kentico.com/articles/module-development-ui-extenders

I followed above link.

  1. I updated object type and Binding object type to the same class in properties.
  2. Created xml like in above link and referenced that in my Uniselector OnInit().
  3. Updated the extender class in Binding->Edit extender.

Can someone help me.

Recent Answers


Dat Nguyen answered on February 10, 2020 07:19 (last edited on February 10, 2020 07:20)

Where exactly do you get the message "No object type selected"? A screenshot is probably useful.

0 votesVote for this answer Mark as a Correct answer

Mani SJ answered on February 11, 2020 00:28 (last edited on February 11, 2020 00:53)

Consider below structure in User Interface of Module

Module
    1. New Object
    2. Edit Object
        2a. General vertical tab(New/Edit Object).
        2b. Asset Vertical tab(Object Listing of a class).
            2b.a Asset Detail(Edit Binding). I did above setting in question here.

So now upon visiting particular module page and clicking Asset vertical tab. I have a button in it, when I click the button it shows a modal dialog window saying "No object type Selected". I expect it to show a uni-selector of particular class where I can select needed options and then the selected options will show in Asset vertical tab unigrid.

In order to better explain I need to share more images from my project that's why I explained my scenario above.

0 votesVote for this answer Mark as a Correct answer

Dat Nguyen answered on February 11, 2020 07:10 (last edited on February 11, 2020 07:11)

In your Asset Detail UI element, you probably are missing one or more of the following: the Binding object type, the Target object type, and the Where condition (all in the Properties tab under the Binding heading).

The Binding object type should be the Binding class.

The Target object type should be the class that the edited object type has the relationship with.

The Where condition determines which specific object is being configured. There should be something like this in that field:

EditedObjectID == {% UIContext.ObjectID %}, where "EditedObjectID" should be replaced by the actual primary key column name of the edited object's class table.

Additionally, you should select (inherit) for Object type and (automatic) for Parent object type.

0 votesVote for this answer Mark as a Correct answer

Mani SJ answered on February 11, 2020 23:29 (last edited on February 11, 2020 23:59)

Nothing helps. Below done in Asset Detail UI element

I did (inherit) for Object type and (automatic) for Parent object type.

Binding object type - class to be in uniselector. Same class for 2b and 2b.a (object type set in 2b so inherit in 2b.a, this object type different from module object type)

Target object type - Edited object class(same object type as set in Module)

Where condition ParentID == {% ToInt(UIContext.ParentObjectID) %} in 2b. Works fine . Referred Parent-child relationship kentico document. They did not said ParentID(in my case) to be a primary key column.

Tried ParentID == {% ToInt(UIContext.ParentObjectID) %} and ParentID = {% UIContext.ObjectID %} in 2b.a. Not worked but you said it to be primarykey(ParentID is not)

*ParentID is a column in AssetDetail table but its not primary key. It has relation to the primary key of the Asset table.

I had the extender applied. To be more clear

  1. When I visit the module in CMS Administration, I have a new button(handled by 1 in module UI structure above) + list(unigrid) of module object type.
  2. When I click edit action in above unigid I go into General vertical tab(handled by 2a in module UI structure above). Here I am in edit mode.
  3. When I click Asset vertical tab(handled by 2b in module UI structure above) I see a button. I am not sure whether I am in edit mode still.
  4. When I click above button(handled by 2b.a in module UI structure above), Still same error in modal dialog.

When I searched the "No object type selected" in Kentico Solution. I found below in CMS.resx

 <data name="ui.editing.noobjecttype" xml:space="preserve">
    <value>No object type selected.</value>
  </data>

When I searched "ui.editing.noobjecttype" in Kentico Solution. I found below in CMSModules\AdminControls\Controls\UIControls\BindingEditItem.ascx.cs

protected override void OnInit(EventArgs e)
{
    editElem.ContextResolver.SetNamedSourceData("UIContext", UIContext);
    base.OnInit(e);

    if (UIContext.EditedObject == null)
    {
        ShowError(GetString("ui.editing.noobjecttype"));
        StopProcessing = true;
    }
}

If I can resolve with your help, I can proceed this way. Alternatively, I used a aspx page with checkbox list to show AssetDetail data in modal dialog. I achieved the functionality but the UI is not like kentico that's why I am still pushing the module way.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.