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
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
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
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
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!
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");