Telerik Forums
UI for ASP.NET MVC Forum
1 answer
628 views

 

I have a EditorTemplate which is:

@model string
 
@(this.Html.Kendo().DropDownList()
    .Name(this.ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
    .Value(this.Model)
    .HtmlAttributes(new { style = "width: 220px;"})
    .OptionLabel("Select)
    .DataValueField("Value")
    .DataTextField("Text")
        .DataSource(ds => ds.Read(read => read.Action("GetList", "Combo").Data("getAdditionalParam")))
)

I want to get this dropdown in my function:

function getAdditionalParam(dropDown){
//do stuff with dropDown

//

 return { additionParam: 1 }
}

 

Is there anyway to pass the object itself as parameter?

 

Thanks,

Ezequiel

Georgi Krustev
Telerik team
 answered on 14 Jul 2015
1 answer
478 views

 When using "Filter Multi Checkboxes "  I get an error saying cannot convert CompositeFilterDescriptor

 to FilterDescriptor . on this line "For Each filterDescriptor As FilterDescriptor In request.Filters"

I understand the error, but  how to get around it,

thanks

 

Imports Kendo.Mvc
Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.Data.Entity
 
Namespace Models.Students
    Public Class StudentGridModel
        Public Property PageSize As Integer = 25
        Private _Students As ReadOnlyCollection(Of BO.Models.Students.Student)
        <System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")> Public Property Students As ReadOnlyCollection(Of BO.Models.Students.Student)
            Get
                Return _Students
            End Get
            Set(value As ReadOnlyCollection(Of BO.Models.Students.Student))
                _Students = value
            End Set
        End Property
 
        Public Property Total As Integer
 
        Sub New()
            Using db As EF.GrasshopperEntities = New EF.GrasshopperEntities
                Me._Students = New ReadOnlyCollection(Of BO.Models.Students.Student)(db.Students.Include(Function(i) i.Franchisee).OrderBy(Function(o) o.StudentId).Take(Me.PageSize).AsEnumerable.Select(Function(s) New BO.Models.Students.Student With {
                                .FirstName = s.FirstName,
                                .FranchiseeName = s.Franchisee.Name,
                                .LastName = s.LastName,
                                .Age = s.Age,
                                .Birthday = s.Birthday,
                                .Female = s.Female,
                                .Suburb = s.Suburb,
                                .PhoneNumber = s.PhoneNumber,
                                .MobileNumber = s.MobileNumber,
                                .Email = s.Email,
                                .TotalSales = s.Sales(),
                                .ProductSales = s.Sales(Function(t) Not t.ProductId.Equals(0)),
                                .EnrolmentSales = s.Sales(Function(t) Not t.EnrolmentId.Equals(0)),
                                .EventSales = s.Sales(Function(t) Not t.StudentEventId.Equals(0)),
                                .StudentId = s.StudentId}).ToList)
                Me.Total = db.Students.Count
            End Using
 
        End Sub
 
        Sub New(request As UI.DataSourceRequest)
            Using db As EF.GrasshopperEntities = New EF.GrasshopperEntities
                Me._Students = New ReadOnlyCollection(Of BO.Models.Students.Student)(GetData(request, Me.Total))
            End Using
        End Sub
 
        ''' <summary>
        ''' Reterns student data for kendo grid
        ''' </summary>
        ''' <param name="request">Kendo.Mvc.UI.DataSourceRequest</param>
        ''' <param name="Total">Integer</param>
        ''' <returns>ReadOnlyCollection(Of BO.Models.Students.students)</returns>
        ''' <remarks></remarks>
        Private Shared Function GetData(ByVal request As Kendo.Mvc.UI.DataSourceRequest, ByRef total As Integer) As ReadOnlyCollection(Of BO.Models.Students.Student)
            Using db As EF.GrasshopperEntities = New EF.GrasshopperEntities
                Dim data As IQueryable(Of EF.Student) = db.Students.Include(Function(i) i.Franchisee)
                If Not request.Sorts Is Nothing AndAlso request.Sorts.Any Then
                    For Each sortDescriptor As SortDescriptor In request.Sorts
                        data = SortStudent(sortDescriptor, data)
                    Next
                Else
                    data = data.OrderBy(Function(o) o.StudentId)
                End If
 
                If request.Filters.Any() Then
                    Dim filterValue As String = String.Empty
                    For Each filterDescriptor As FilterDescriptor In request.Filters
 
                        Select Case filterDescriptor.Member
                            Case "FranchiseeName"
                                filterValue = CStr(filterDescriptor.ConvertedValue)
                                Select Case filterDescriptor.Operator
                                    Case FilterOperator.Contains
                                        data = data.Where(Function(w) w.Franchisee.Name.Contains(filterValue))
                                    Case FilterOperator.DoesNotContain
                                        data = data.Where(Function(w) Not w.Franchisee.Name.Contains(filterValue))
                                    Case FilterOperator.EndsWith
                                        data = data.Where(Function(w) w.Franchisee.Name.EndsWith(filterValue))
                                    Case FilterOperator.IsEqualTo
                                        data = data.Where(Function(w) w.Franchisee.Name.Equals(filterValue))
                                    Case FilterOperator.IsNotEqualTo
                                        data = data.Where(Function(w) Not w.Franchisee.Name.Equals(filterValue))
                                    Case FilterOperator.StartsWith
                                        data = data.Where(Function(w) w.Franchisee.Name.StartsWith(filterValue))
                                End Select
                        End Select
                    Next
                End If
                If request.Filters.Any() Then
                    data = data.Where(ExpressionBuilder.Expression(Of EF.Student)(request.Filters))
                End If
                total = data.Count
 
                If request.PageSize > 0 Then
                    data = data.Skip((request.Page - 1) * request.PageSize)
                    data = data.Take(request.PageSize)
                End If
                Return New ReadOnlyCollection(Of BO.Models.Students.Student)(data.AsEnumerable.Select(Function(s) New BO.Models.Students.Student With {
                                        .FranchiseeName = s.Franchisee.Name,
                                        .FirstName = s.FirstName,
                                        .LastName = s.LastName,
                                        .Age = s.Age,
                                        .Birthday = s.Birthday,
                                        .Female = s.Female,
                                        .Suburb = s.Suburb,
                                        .PhoneNumber = s.PhoneNumber,
                                        .MobileNumber = s.MobileNumber,
                                        .Email = s.Email,
                                        .TotalSales = s.Sales(),
                                        .ProductSales = s.Sales(Function(t) Not t.ProductId.Equals(0)),
                                        .EnrolmentSales = s.Sales(Function(t) Not t.EnrolmentId.Equals(0)),
                                        .EventSales = s.Sales(Function(t) Not t.StudentEventId.Equals(0)),
                                        .StudentId = s.StudentId}).ToList)
            End Using
 
        End Function
 
        Private Shared Function SortStudent(sortDescriptor As SortDescriptor, data As IQueryable(Of EF.Student)) As IQueryable(Of EF.Student)
            If sortDescriptor.SortDirection.Equals(ListSortDirection.Ascending) Then
                Select Case sortDescriptor.Member
                    Case "StudentId"
                        data = data.OrderBy(Function(o) o.StudentId)
                    Case "FranchiseeName"
                        data = data.OrderBy(Function(o) o.Franchisee.Name)
                    Case "FirstName"
                        data = data.OrderBy(Function(o) o.FirstName)
                    Case "LastName"
                        data = data.OrderBy(Function(o) o.LastName)
                    Case "Age"
                        data = data.OrderBy(Function(o) o.Birthday)
                    Case "Female"
                        data = data.OrderBy(Function(o) o.Female)
                    Case "Suburb"
                        data = data.OrderBy(Function(o) o.Suburb)
                End Select
            Else
                Select Case sortDescriptor.Member
                    Case "StudentId"
                        data = data.OrderByDescending(Function(o) o.StudentId)
                    Case "FranchiseeName"
                        data = data.OrderByDescending(Function(o) o.Franchisee.Name)
                    Case "FirstName"
                        data = data.OrderByDescending(Function(o) o.FirstName)
                    Case "LastName"
                        data = data.OrderByDescending(Function(o) o.LastName)
                    Case "Age"
                        data = data.OrderByDescending(Function(o) o.Birthday)
                    Case "Female"
                        data = data.OrderByDescending(Function(o) o.Female)
                    Case "Suburb"
                        data = data.OrderByDescending(Function(o) o.Suburb)
                End Select
            End If
            Return data
        End Function
    End Class
End Namespace
 

 

 

Atanas Korchev
Telerik team
 answered on 13 Jul 2015
1 answer
95 views

I have a grid with multiple ForeignKey columns which work nicely however i'd like to be able to set up some column dependencies.

Is the above possible to have a child ForeignKey column either updated or filtered based on the selected value of the parent ForeignKey column?

Ideally i'd like to call an action on change as the initial data is generated in the controller.

So far I've not been able to find an example that does all of the above.

Thanks

Graeme

Vladimir Iliev
Telerik team
 answered on 13 Jul 2015
1 answer
213 views

Hello,

Is it possible to format the urlTemplate in such a way that we can connect a layer of type Tile to a Web Mapping Server?

The problem seems to be fulfilling the BBOX parameter that the WMS Standard expects.

If not, could you please suggest a suitable work-around one can implement to get the Layers from a WMS integrated?

Regards,

Aaron

T. Tsonev
Telerik team
 answered on 10 Jul 2015
1 answer
99 views

Hi!  I'm wondering how one can upload asynchronously given the following:

     -- Auto upload is false

     -- User clicks an upload button to initiate the upload via ajax WITHOUT doing a form post.

Thanks!

Dimiter Madjarov
Telerik team
 answered on 10 Jul 2015
1 answer
73 views

Is there a way to "Select All" users in the editor popup?

I'm using .AutoClose(false), but that's not enough for the client. They want to select all users.

I'm using editable.TemplateName("CustomEditorTemplate");

Vladimir Iliev
Telerik team
 answered on 10 Jul 2015
1 answer
414 views
Is there a way to remove the top border from the NumericTextBox? I have already removed the spinner but I need the top border gone and any padding.
Plamen Lazarov
Telerik team
 answered on 09 Jul 2015
2 answers
85 views
I tried to upload a zip file through "attach files". But it failed to be uploaded and each time connection were lost in uploading. What is the problem?
york
Top achievements
Rank 1
 answered on 09 Jul 2015
2 answers
116 views
Hi,

I want to edit and display in a kendo window a time property (format HH:mm). 
I started with the Time editor and with a DateTime attribute, but the value to be biended is not displayed in the form.
How can we fix it ?
Apparently the Timepicker supports a TimeSpan value, but Javascript doesn't support Timespan (json serialization problems).
ex : @Html.EditorFor(m => m.StartTime, "Time")

Thanks for your help
Stephane
Top achievements
Rank 1
 answered on 08 Jul 2015
1 answer
365 views
I'm trying to add a custom button on a TreeList Toolbar.   I can see that .Toolbar (t=>t.Custom().Text("My Action")) is exactly what I'm looking for, however what is not obvious is how to add the action.   For the Grid, it would be .Toolbar(t=>t.Custom().Action("Action", "Controller").Text("My Action").   Why does TreeList have similiar behaviour?
Dimiter Madjarov
Telerik team
 answered on 08 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?