Telerik Forums
UI for ASP.NET MVC Forum
1 answer
599 views
Hi guys,

I have a menu exposed as a column in a grid. In the old system I'm changing over to the grid I iterate over each item, inspect some value, and determine if the menu item should be included. I'm not sure how I would do this with the MVC helper because it's based on values from each row. Here's my grid/menu:

01.@(Html.Kendo().Grid<ListingViewModel>()
02.      .Name("grid")
03.      .DataSource(dataSource => dataSource
04.          .Ajax()
05.          .Read(read => read.Action("RefreshTable", "Authorizations"))
06.      )
07.      .Columns(columns =>
08.      {
09.          columns.Bound(x => x.Number)
10.              .Template(@<text></text>).HtmlAttributes(new { @class = "templateCell" })
11.              .ClientTemplate(
12.                Html.Kendo().Menu()
13.                    .Name("menu_#=Number#")
14.                    .OpenOnClick(true)
15.                    .Events(e => e.Select("selectMenu"))
16.                    .Items(its => its.Add().Text("#=Number#").Items(nested =>
17.                    {
18.                        nested.Add().Text("Edit").HtmlAttributes(new { data_number = "#=Number#" });
19.                        nested.Add().Text("Add Comment").HtmlAttributes(new { data_number = "#=Number#" });
20.                        nested.Add().Text("Cancel").HtmlAttributes(new { data_number = "#=Number#" });
21.                        nested.Add().Text("Transfer").HtmlAttributes(new { data_number = "#=Number#" });
22.                        nested.Add().Text("View Comments").HtmlAttributes(new { data_number = "#=Number#" });
23.                    }))
24.                    .ToClientTemplate().ToHtmlString());
25.          columns.Bound(x => x.Status);
26.          columns.Bound(x => x.Started);
27.          columns.Bound(x => x.Description);
28.      })
29.      .Pageable()
30.      .Sortable()
31.      .Events(events => events.DataBound("initMenus"))
32.    )

So lines 18-22 are where I build the menu. In my situation I want to include 18 and 19 if the status is a certain value and include line 20 if the description contains anything (as an example).

Even if I did this after the fact going through the entire grid using some event I really need access to the view model, or else I'll have to expose (or maybe hide) some additional fields that are used as part of the determination. For example there might be a .UserCount field that's not exposed but is needed to determine if the menu item in line 22 is added or not.

I'm looking to hide or show menu items based on the row data but could also just grey out/disable some items. In any case I'm not sure how to do this with my model and it seems like the only way to do something like this is to interrogate the HTML after the grid is built.

Hopefully that explains what I'm looking to do and what I'm working with.

Thanks.
Daniel
Telerik team
 answered on 31 Mar 2014
1 answer
258 views
Hello,

I have an XML file with variable number of Tabs and controls(TextBox,combobox,grid etc) to be displayed whne each tab is selected. My Controller parses the XML and creates a model of type
Dictionary<string, DefaultControlsViewModel>
where string part is the tabitem.text and DefaultControlsViewModel is a list of different controls to be displayed in that tab.
I Need to create all the Tabs and ist Contents dynamically on load. Is there a way to bind this Kind of model to view having a tabstripe and create all Tabs and ist controls dynamically?Attached a small sample Project, i have controls.xml and model with tab Name and Array of controls in that tab. Need the code for binding the model to tabstripe in index.cshtml

Thanks

Anamika
Dimo
Telerik team
 answered on 31 Mar 2014
2 answers
169 views
Hi Telerik Team.

I copy paste the Telerik code of "ScheldulerCustomEditor".

I have the following error : "The field Start must be a date/ The field End must be a date".

I search in the forum but I don't thing it's a trouble of culture.
In FireBug, the right "cultures/kendo.culture.fr-FR.min.js" is loaded.
And
     var culture = Thread.CurrentThread.CurrentUICulture.ToString();
     var cultureServer = Thread.CurrentThread.CurrentCulture.ToString();
give both "fr-FR" as a result.

And i followed the Kendo Globalization tutorial
var culture = System.Globalization.CultureInfo.CurrentCulture.ToString();
<script src="@Url.Content("~/Scripts/kendo/2014.1.321/cultures/kendo.culture." + culture + ".min.js")"></script>

I solved this trouble with Data annotation

[DataType(DataType.Time)]
[UIHint("End")]
[Required(ErrorMessage = "Please select a End time")]
[DateGreaterThan(OtherField = "Start")]
public DateTime End
{
    get
    {
        return end;
    }
    set
    {
        end = value.ToUniversalTime();
    }
}

But i have another error. It's display that "The isAllDay field is required".
Alexander Popov
Telerik team
 answered on 31 Mar 2014
1 answer
121 views
Hi,

I am getting Drag and Drop issue of the Kendo UI Treeview control in IE 10 and 11.

Help is required on this. It's very urgent.

Regards,
Satish.N 
Petur Subev
Telerik team
 answered on 31 Mar 2014
1 answer
115 views
As of time of this post, the ForeignKey demo at

http://demos.telerik.com/kendo-ui/web/grid/foreignkeycolumn.html

does work on Chrome and Internet Explorer but does not work on FireFox.  The category dropdown list does not display properly so that values can be selected.

This test was done on current FireFox 28.0.

Also it would be nice if there was a simpler more elegant way to create a ForeignKey dropdown list other than what's shown in the demo.
Kamen Bundev
Telerik team
 answered on 31 Mar 2014
1 answer
71 views
I have a ajax bound grid with the following client template:

ClientTemplate("<img onclick='grdCreateClick(#=TransactionID#,#=FormID#,#=UserID#,#=DetailID#);' />")

Is there a way to pass the entire data item row instead of passing each field like:

ClientTemplate("<img onclick='grdCreateClick(data);' />")

any help is appreciated.

Thanks...
Nikolay Rusev
Telerik team
 answered on 31 Mar 2014
2 answers
183 views
I am trying to add a data parameter to a grid read:

.Read(read => read.Action("NotesRead", "Server").Data(ViewBag.ServerId))

I have the controller as:

public ActionResult NotesRead([DataSourceRequest]DataSourceRequest request, string ServerId)

it is throwing the following error:

The call is ambiguous between the following methods or properties: 'Kendo.Mvc.UI.Fluent.CrudOperationBuilderBase<Kendo.Mvc.UI.Fluent.CrudOperationBuilder>.Data(System.Func<object,object>)' and 'Kendo.Mvc.UI.Fluent.CrudOperationBuilderBase<Kendo.Mvc.UI.Fluent.CrudOperationBuilder>.Data(string)'

Andy Macourek
Top achievements
Rank 1
 answered on 29 Mar 2014
2 answers
213 views
My intellisense for Kendo ui doesn't work, I have already checked and have the correct using in the web config.

      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="Mbm.Web.RTPM.Helpers" />
        <add namespace="Kendo.Mvc.UI" />
        <add namespace="Telerik.Reporting" />
        <add namespace="Telerik.ReportViewer.Mvc"/>
      </namespaces>
Donald
Top achievements
Rank 1
 answered on 28 Mar 2014
1 answer
112 views
Hi Support,

How can i change the the grid filter format of numeric textbox to just textbox for integer column.

See the attachment i want to change that numeric textbox to normal textbox.


Thanks
Petur Subev
Telerik team
 answered on 28 Mar 2014
1 answer
187 views
I have a kendo grid which is populated form the database(works all fine) now when I click the "select" template column in the grid I want it to route to another page that has two controls:
a kendogrid and a list/table(both populated using sprocs ffrom database by passing in the productid from 1st grid)
How do I achieve this? I only get the json data in raw form on the page and not in the table..and I am not sure how to populate the list/table

​$(document).ready(function () {
var pId = '@(Model.ProductId)';
$.ajax({
type: "POST",
url: '@(Url.Action("GetDetails", "Search"))',
data: JSON.stringify({ ProductId: pId }),
contentType: "application/json; charset=utf-8",
dataType: "JSON",
success: function (data) {
$('#DetailsGrid').data('kendoGrid').dataSource.fetch();
},
});
});
Dimiter Madjarov
Telerik team
 answered on 28 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?