Telerik Forums
UI for ASP.NET MVC Forum
3 answers
268 views
I tried this solution (http://www.telerik.com/support/code-library/submit-form-containing-grid-along-with-other-input-elements), for posting a grid inside an html forum and work correctly.
But if I have a grid with checkboxes I don't understend how I can the true or false value.

I've tried this solution, but doesn't work.

columns.Bound(p => p.Inside).ClientTemplate(
"<input type='checkbox' #= (Inside=== true) ? checked : '' # />" +
"<input type='hidden' name='CAB[#= indexCAB(data)#].Inside' value='#= Inside#' />");

Someone can help me.

Thanks
Daniel
Telerik team
 answered on 01 Apr 2014
1 answer
265 views
Hi,

I have the following kendo grid in my page:

@(Html.Kendo().Grid<Di.Service.Tracking.Models.DomainObjects.DTrackingFileEvent>()
 .Name("fileAuditing")
 .Columns(columns =>
{
columns.Bound(c => c.IsError);
columns.Bound(c => c.EventDateTime).Title(@Di.Nls.Label.Event_Date_Time);
columns.Bound(c => c.Details).Title(@Di.Nls.Label.Details);
columns.Bound(c => c.Description).Title(@Di.Nls.Label.Description);
columns.Bound(c => c.Result).Title(@Di.Nls.Label.Result);
})
.ClientRowTemplate(
"<tr bgcolor=#:IsError ? 'Pink' : 'White'# data-uid='#: uid #'>" +
  "<td>" +
  "# if(IsError == true) {# " +
"<img src='/Images/FileState/Error.gif' />" +
"#} else {# " +
"<img src='/Images/FileState/Ok.gif' />" +
"#}#" +
  "</td>" +
  "<td>#: EventDateTime #</td>" +
  "<td>#: Details #</td>" +
  "<td>#: Description #</td>" +
  "<td>#: Result #</td>" +
"</tr>"
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("FileAuditingDetails", "FileDetails", new { iFileID = iFileID }))
.Events(e=>e.RequestEnd("onRequestEnd"))
)
)

<script>
function onRequestEnd(e) {
  //do something with event date time
}
</script>

My goal is to format the "Event date time" column so it provides a value based on the user time zone info. In order to do that I wanted to handle the "requestEnd" event, but when I do that I cannot see any data on the grid.

Removing the following line .Events(e=>e.RequestEnd("onRequestEnd")) load all the data correctly.

Any ideas how to achieve my goal?
Alexander Popov
Telerik team
 answered on 01 Apr 2014
1 answer
165 views
Hi there,

I am just getting to grips with WebApi and how to use them with the MVC wrappers. But I am at a loss on how to ensure that the authentication is working correctly as part of the project.

My scenario is I have front end website (www.myfrontendwebsite.com) which is running on one server and then I have the service website with all my Business logic running on a webapi back end website (www.mywebapiwebsite.com) this may/ may not be running on a separate website.

I am forcing my users to log in to ensure that they can access only the parts of the sites they should have.

Obviously with the web api project this needs to be protected as well so I need the user to be authenticated.

Now I am  trying to do something like this with a combobox:


Html.Kendo().ComboBox()
.Name("DateSetup")
.Suggest(true)
.Filter(FilterType.Contains)
.DataSource(data =>
{
data.Read(read => read.Url("http://localhost:59236/api/GenericReport/GetDateFilterTypes"));
})
.Placeholder("Select date setup")


so I know I need to add some additional information to the header that is being provided but how can I do that from the read.Url method? Do I do this via adding .Data afterwards or is there another way of do it.

I have already enabled CORS to work as this works when I an using allow annoynomous.

Thanks in advance.


                      .HtmlAttributes(new { style = "min-width:100%;" })

Daniel
Telerik team
 answered on 01 Apr 2014
5 answers
353 views
I have a kendo grid which uses server binding. I need to implement batch update in the same. How can i proceed for this.
Below is the example of grid I am using.

@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p=> p.addressId).Hidden(true);
columns.Bound(p=> p.Name).Title("Name");
columns.Bound(p=> p.Phone);
)
.Pageable() //Enable paging
.ToolBar(commands => commands.Create())
//Editable(editable => editable.Mode(GridEditMode.Inline))
.DataSource(dataSource => dataSource
.Server()
//.Batch(true)
// Configure CRUD -->
.Model(model => model.Id(p => p.ContactId))
.Create(create => create.Action("Create", "Home"))
.Read(read => read.Action("Index", "Home"))
.Update(update => update.Action("Update", "Home"))
.Destroy(destroy => destroy.Action("Destroy", "Home"))
// <-- Configure CRUD
)
.DetailTemplate(...)
)

Now i want to have a button, on click of which the data in the grid could be updated. What is the best way to proceed with this.
Batch(true) is not working with Server()?
Petur Subev
Telerik team
 answered on 31 Mar 2014
1 answer
586 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
257 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
168 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
120 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
112 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
70 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?