0

I have an application using kendo tap strip, so all fields should have unique name in all opened tabs, the only problem I have with that is how to create more than one foreign key editor template for the same property name with unique name for more than one grid since the combo box should has the same name as the view model property name, if I create more than one combo box editor template with the same name it will return a conflict in the system, so are there any workaround that I can use here?

In simple word Suppose I have two grid (selling order and purchase order) both grids has foreign key column called "Supplier" -the foreign key called in both tables SupplierID-, I create two editor template one for each grid here as my template (both template are identical)

@model object
@using MyResource =Resources.Layout;
@( Html.Kendo().ComboBox()
                  .DataTextField("SupplierID")

                      .DataValueField("SupplierID").Name("SupplierID")
                      .Placeholder(MyResource.SelectSupplier)
      .Filter("contains").DataSource(source =>
                      {source.Read(read =>
                          { read.Action("GetSuppliers", "Item");
                          }).ServerFiltering(true);
                      }).AutoBind(false))

So if I open both grids an error will occur because both grid has foreign key combo box with the same name (SupplierID)

2
  • It's pretty hard to understand what you're trying to do - consider adding some code to illustrate your problem Commented Dec 9, 2013 at 21:09
  • I add more description and code Commented Dec 10, 2013 at 6:51

2 Answers 2

1

Check the following post from Kendo UI forums: http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/grid-foreign-key-field-sometime-shows-textbox.aspx

Sign up to request clarification or add additional context in comments.

Comments

0

My Problem Solved By passing the grid name to the editor template using the ViewData and set the ID property for the combobox to be the grid Name + PropertyName

 Html.Kendo().ComboBox().DataTextField("SupplierID")
        .DataValueField("SupplierID")
        .Name("SupplierID")
    .Filter("contains")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetSuppliers", "Item");
        })
        .ServerFiltering(true);
    })

     .HtmlAttributes(new Dictionary<string, object> {

            { "id" , ViewData["GridName"] + "_Supplier" }
        })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.