or
<
div
class
=
"form-group"
>
@Html.Label("User Role(s)")
@{
(Html.Kendo().MultiSelectFor(model => model.SelectedRoles)
.Name("SelectedRoles")
.HtmlAttributes(new {style = "width: 400px"})
.Placeholder("Please select role(s)...")
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source =>
{
source.Read(read =>
{
read.Url("/api/gmcmembership/roles").Type(HttpVerbs.Get);
});
})
.Value(Model.SelectedRoles)
.AutoBind(false)
).Render();
}
</
div
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.Mvc;
namespace
GMCWebApplication.Areas.admin.Models
{
public
class
UserDetailViewModel
{
[HiddenInput]
public
string
Id {
get
;
set
; }
public
int
CompanyCode {
get
;
set
; }
public
string
UserType {
get
;
set
; }
public
int
Question1 {
get
;
set
; }
public
int
Question2 {
get
;
set
; }
public
string
Question1Answer {
get
;
set
; }
public
string
Question2Answer {
get
;
set
; }
// public string PasswordHash { get; set; }
public
string
PhoneNumber {
get
;
set
; }
public
string
NewPassword {
get
;
set
; }
public
List<UserRoleViewModel> SelectedRoles {
get
;
set
; }
public
List<UserRoleViewModel> AllRoles {
get
;
set
; }
}
}
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
namespace
GMCWebApplication.Areas.admin.Models
{
public
class
UserRoleViewModel
{
public
string
Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
}
[System.Web.Http.HttpGet]
[System.Web.Http.Route(
"roles"
)]
public
IHttpActionResult GetRoles()
{
try
{
var list =
new
List<UserRoleViewModel>();
using
(var context =
new
ApplicationDbContext())
{
list = context.Roles.Select(p =>
new
UserRoleViewModel { Id = p.Id, Name = p.Name })
.ToList<UserRoleViewModel>();
}
return
Ok(list);
}
catch
(Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
return
InternalServerError();
}
}
@(Html.Kendo().Grid(Model)
.Name(
"ServiceGrid"
)
.Pageable(action => action.Enabled(
true
)
.ButtonCount(8)
/*.PageSizes(new[] {25, 100, 500}) TODO this yields an error in the current Telerik */
.Refresh(
true
))
.DataSource(data => data
.Ajax()
.Events(events => events.Error(
"grid_onError"
))
.Model(model =>
{
model.Id(m => m.Name);
})
.Read(read => read.Action(
"Get"
,
"Service"
))
.Group(g => g.Add(f => f.Host))
)
.Columns(column =>
{
column.Bound(ci => ci.FriendlyName).Title(
"Service"
);
column.Bound(ci => ci.Host).Hidden();
column.Bound(ci => ci.Status);
column.Command(cmd => cmd.Custom(
"Restart Service"
).Click(
"onClickRestartService"
)).Width(120).Title(
"Actions"
);
}))
Uncaught TypeError: undefined is not a
function
kendo.web.min.js:11 ht.extend.pageSize
jquery-2.1.1.js:7328 (anonymous
function
)
jquery-2.1.1.js:375 jQuery.extend.each
jquery-2.1.1.js:139 jQuery.fn.jQuery.each
jquery-2.1.1.js:7320 jQuery.fn.extend.val
kendo.web.min.js:20 u.extend.init
kendo.web.min.js:29 ut.ui.DataBoundWidget.extend._pageable
kendo.web.min.js:28 ut.ui.DataBoundWidget.extend.initkendo.web.min.js:10 (anonymous
function
)
pageSize:
function
(e){
var
n=
this
;
return
e!==t?(n._query({pageSize:e,page:1}),t):n.take()},sort
Uncaught TypeError: undefined is not a
function
kendo.dataviz.min.js:12 ht.extend.success
kendo.dataviz.min.js:12 n.trigger.n.online.n.transport.read.success
kendo.dataviz.min.js:11 n.success
jquery-2.1.1.js:3073 fire
jquery-2.1.1.js:3185 self.fireWith
jquery-2.1.1.js:8251 done
jquery-2.1.1.js:8598 (anonymous
function
)
a._pristineData=e.slice(0),a._detachObservableParents()
01.
<
div
class
=
"content-wrapper"
>
02.
<
div
class
=
"search-wrapper"
>
03.
@using (Html.BeginForm("Search", "Home", FormMethod.Post, new { id="search-form" }))
04.
{
05.
<
div
class
=
"search-top-panel"
>
06.
<
input
id
=
"tbKeywords"
name
=
"tbKeywords"
type
=
"text"
07.
class
=
"k-textbox"
style
=
"width: 600px; font-size: 24px;"
08.
required
validationmessage
=
"Enter a keyword"
09.
placeholder
=
"Enter a Keyword"
/>
10.
</
div
>
11.
<
div
class
=
"search-bottom-panel"
>
12.
<
div
class
=
"search-bottom-left-panel"
>
13.
@Html.ActionLink("Advance Search Options", "Index", "Home", new { search="adv" }, new { @class="standard-link" } )
14.
</
div
>
15.
<
div
class
=
"search-bottom-right-panel"
>
16.
@(Html.Kendo().Button().Name("btnSearch").Content("Hit It!").HtmlAttributes(new { type = "submit", @class = "k-primary" }))
17.
</
div
>
18.
</
div
>
19.
}
20.
</
div
>
21.
</
div
>
01.
[HttpPost]
02.
public
ActionResult Search()
03.
{
04.
ViewBag.Keywords = Request.Form [
"tbKeywords"
];
05.
06.
VideoRepository videoRepository =
new
VideoRepository ( );
07.
08.
List<
string
> keywords =
new
List<
string
> ( );
09.
10.
keywords = Request.Form [
"tbKeywords"
].Split (
new
char
[ ] {
' '
,
','
}, StringSplitOptions.RemoveEmptyEntries ).ToList ( );
11.
12.
IList<Video> lstResults =
new
List<Video>();
13.
14.
IList<Video> videos;
15.
16.
foreach
(
string
keyword
in
keywords)
17.
{
18.
videos = videoRepository.GetAll ( ).Where ( v => v.VIDEO_TITLE.Contains ( keyword ) || v.VIDEO_DESC.Contains ( keyword ) ).ToList ( );
19.
20.
foreach
(Video v
in
videos)
21.
{
22.
if
( !lstResults.Contains ( v ) )
23.
lstResults.Add ( v );
24.
}
25.
}
26.
27.
ViewBag.Results = lstResults;
28.
29.
return
RedirectToAction (
"Index"
,
new
{ view =
"results"
} );
30.
}
01.
@if (Request.QueryString["view"] == "results")
02.
{
03.
<
div
class
=
"ui-memberVideolist"
style
=
"width: 100%;"
>
04.
@(Html.Kendo().ListView<
TheWebDevChannel.Models.VideoManagement.Video
>(ViewBag.Results)
05.
.Name("lvMemberVideoList")
06.
.TagName("div")
07.
.ClientTemplateId("template")
08.
.Pageable()
09.
)
10.
</
div
>
11.
}