Datagrid Column DropDown Template with Template in EditTemplate

Hello radzen team,
i have a problem with the Context in a column template:

                        <RadzenDataGrid @ref="dgEkVkZuschlag" AllowPaging="true" Data="@EkVkZuschlaegeResult" EmptyText="Keine Daten" TItem="Trent.Pages.EkVkZuschlagVm" PageSize="3">
                          <Columns>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" Property="ZuschlagBezeichnungText" Title="Zuschlag" Width="15%">
                              <EditTemplate Context="trentPagesEkVkZuschlagVm">
                                <div class="row">
                                  <div class="col-md-12">
                                    <RadzenDropDown AllowClear="true" AllowSelectAll="false" Data="@ZuschlagBezeichnungDropDown" OpenOnFocus="false" style="display: block; width: 100%" TextProperty="Bezeichnung" @bind-Value="@(trentPagesEkVkZuschlagVm.ZuschlagBezeichnungId)" ValueProperty="ZuschlagBezeichnungId" Name="DdEkVkZuschlagBezeichnung" Change="@((args) =>DdEkVkZuschlagBezeichnungChange(args, trentPagesEkVkZuschlagVm))">
                                      <Template Context="trentPagesEkVkZuschlagVm">
                                        <div class="row">
                                          <div class="col-md-10">
                                            <RadzenLabel Text="@($"{(trentPagesEkVkZuschlagVm.Bezeichnung)}")">
                                            </RadzenLabel>
                                          </div>
                                          <div class="col-md-2">
                                            <RadzenImage Path="assets/images/fragezeichen_blau.svg" style="display: inline; float: left; height: 16px; margin-top: 6px; width: 16px" Visible="@(trentPagesEkVkZuschlagVm.FestOderBedingung==2)">
                                            </RadzenImage>
                                            <RadzenImage Path="assets/images/ausrufezeichen_blau.svg" style="float: left; height: 16px; margin-top: 6px; width: 16px" Visible="@(trentPagesEkVkZuschlagVm.FestOderBedingung==1)">
                                            </RadzenImage>
                                          </div>
                                        </div>
                                      </Template>
                                      <ValueTemplate Context="trentPagesEkVkZuschlagVm">
                                        <div class="row">
                                          <div class="col-md-10">
                                            <RadzenLabel style="padding-top: 0px" Text="@($"{(trentPagesEkVkZuschlagVm.Bezeichnung)}")">
                                            </RadzenLabel>
                                          </div>
                                          <div class="col-md-2">
                                            <RadzenImage Path="assets/images/fragezeichen_blau.svg" style="display: inline; float: left; height: 16px; margin-top: 2px; width: 16px" Visible="@(trentPagesEkVkZuschlagVm.FestOderBedingung==2)">
                                            </RadzenImage>
                                            <RadzenImage Path="assets/images/ausrufezeichen_blau.svg" style="display: inline; float: left; height: 16px; margin-top: 2px; width: 16px" Visible="@(trentPagesEkVkZuschlagVm.FestOderBedingung==1)">
                                            </RadzenImage>
                                          </div>
                                        </div>
                                      </ValueTemplate>
                                    </RadzenDropDown>
                                    <RadzenRequiredValidator Component="DdEkVkZuschlagBezeichnung" DefaultValue="0" Text="Auswahl erforderlich" Visible="@(dispoTerminArtikel.EKZuschlagPreis != null)">
                                    </RadzenRequiredValidator>
                                  </div>
                                </div>
                              </EditTemplate>
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" Property="EkEinheitBezeichnung" Title="Ek Einheit" Width="5%">
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" FormatString="{0:C}" Property="Ek" Title="Ek" Width="5%">
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" Property="VkEinheitBezeichnung" Title="Vk Einheit" Width="5%">
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" FormatString="{0:C}" Property="Vk" Title="Vk" Width="5%">
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" Property="FestOderBedingung" Title="Fest Oder Bedingung" Width="5%">
                            </RadzenDataGridColumn>
                            <RadzenDataGridColumn TItem="Trent.Pages.EkVkZuschlagVm" Filterable="false" Frozen="true" Groupable="false" MinWidth="120px" Pickable="false" Reorderable="false" Resizable="false" Sortable="false" Width="120px">
                              <Template Context="trentPagesEkVkZuschlagVm">
                                <RadzenButton ButtonStyle="ButtonStyle.Secondary" Image="assets/images/pencil-solid.svg" Size="ButtonSize.ExtraSmall" Visible="@(EkVkZuschlagVmToInsert == null && EkVkZuschlagVmToUpdate == null)">
                                </RadzenButton>
                                <RadzenButton Image="assets/images/thumbs-up-solid.svg" Size="ButtonSize.ExtraSmall" style="margin-left: 5px" Visible="@(EkVkZuschlagVmToInsert != null || EkVkZuschlagVmToUpdate != null)">
                                </RadzenButton>
                                <RadzenButton ButtonStyle="ButtonStyle.Warning" Image="assets/images/thumbs-down-solid.svg" Size="ButtonSize.ExtraSmall" style="margin-left: 5px" Visible="@(EkVkZuschlagVmToInsert != null || EkVkZuschlagVmToUpdate != null)">
                                </RadzenButton>
                                <RadzenButton ButtonStyle="ButtonStyle.Warning" Image="assets/images/papierkorb-hell.svg" Size="ButtonSize.ExtraSmall" style="margin-left: 5px" Visible="@(EkVkZuschlagVmToInsert == null && EkVkZuschlagVmToUpdate == null)">
                                </RadzenButton>
                              </Template>
                            </RadzenDataGridColumn>
                          </Columns>
                        </RadzenDataGrid>

I receive an compile error:
The child content element 'Template' of component 'RadzenDropDown' uses the same parameter name ('trentPagesEkVkZuschlagVm') as enclosing child content element 'EditTemplate' of component 'RadzenDataGridColumn'. Specify the parameter name like: "Template Context="another_name" to resolve the ambiguity

It sounds that i must change the "Context" value?!
If i must do so... how can i do that in Radzen IDE?

Please Help
Thomas

The Context in RadzenDropDown Template seems to be wrong.
Its the same name as the EditTemplate Context, but its an other Type

The Edit Context is of Type "EkVkZuschlagVm"
The RadzenDropDown Template Context must be of Type "Trent.Models.Trentdb.ZuschlagBezeichnung" but the Type is "dynamic"

Perhaps that is the problem?

I'm afraid that this is limitation of Radzen IDE that cannot be avoided easily - that's why we've made Radzen Blazor Studio to overcome exactly such limitations.
There are only two options:

  • define the template as string instead the template designer. You will have control how the Context will be named.
  • put the .razor in ignore list and apply desired modification.

@enchev Ah... ok.
i will try it with a template string

Thanks for help!

I tried it and it works for me.
But btw...
The Context Name of the Template is always "data". I cannot name it myself.
Or am i doing something wrong?

                                          **<Template Context="data">**
                                              <div class="row">
                                                  <div class="col-md-10">
                                                      <RadzenLabel Text="@($"{(data.Bezeichnung)}")">
                                                      </RadzenLabel>
                                                  </div>
                                                  <div class="col-md-2">
                                                      <RadzenImage Path="assets/images/fragezeichen_blau.svg" style="display: inline; float: left; height: 16px; margin-top: 6px; width: 16px" Visible="@(data.FestOderBedingung == 2)">
                                                      </RadzenImage>
                                                      <RadzenImage Path="assets/images/ausrufezeichen_blau.svg" style="float: left; height: 16px; margin-top: 6px; width: 16px" Visible="@(data.FestOderBedingung == 1)">
                                                      </RadzenImage>
                                                  </div>
                                              </div>
                                      
                                          </Template>

Yes, you are right - I spoke too soon. You can name it only when using the ignore list - for string templates will be always data, sorry.