Hi Team,
I am facing problem in cancelling the grid with Inline Edit. Currently I have a grid that displays ApplicationName and AccessLevelvalues when we click edit and update this grid is working fine. But When I click edit and cancel it, my name field for any other rows will be getting replaced with ApplicationName of first row.. My code snippet is
<div style="position:relative;">
<div style="float:left;position:relative; width:200px;">
<label>UserName:</label>
@(Html.Kendo().DropDownList()
.Name("Users")
.DataTextField("FullNameLastFirstMiddle")
.DataValueField("UserGuid")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsers", "User");
});
})
//.Events(e => e.Select("Dummy"))
.Events(e => e.Change("OnUserChange"))
.SelectedIndex(0)
)
</div>
<div style="float:left;width:100%; position:relative;padding:10px;">
@(Html.Kendo().Grid<MODEL>()
.Name("grid")
.AutoBind(false)
.Scrollable(sc => sc.Height(250))
.Columns(columns =>
{
columns.Bound(a => a.UserGuid).Hidden();
columns.Bound(a => a.ApplicationName);
columns.Bound(a => a.AccessLevelName).EditorTemplateName("AccessLevelList");
/////
columns.Command(commands => { commands.Edit(); }).Width(100);
})
.Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode.
.HtmlAttributes(new { style = "height:400px;" })
.DataSource(ds => ds
.Ajax()
.PageSize(10)
.ServerOperation(false)
.Read(read => read.Action("GetApplicationGrid", "User").Data("ApplicationAccessData"))
.Model(model =>
{
model.Id(app => app.UserGuid);
model.Field(app => app.ApplicationName).Editable(false);
model.Field(app => app.AccessLevelGuid).Editable(false);
// Make the application name property not editable.
})
.Events(events => events.Sync("KendoGridfresh"))
.Update(update => update.Action("UpdateAccess", "User")
)
)
)
</div>
</div>
<script>
var appItem;
function KendoGridfresh() {
var grid = $("#grid").data("kendoGrid");
grid.dataSource.read();
}
function OnUserChange(e) {
appItem = this.value();
var grid = $("#grid").data("kendoGrid");
grid.dataSource.read();
grid.refresh();
}
function ApplicationAccessData(e) {
var item = appItem
return { item: item }
}
</script>
Hi,
I am using a treeview to load data and on edit of a row, i would want to display a dropwon to choose data, i tried below to get the dropdown, but this does not give me a dropdown, please advise if this is possible or how to achieve this.
columns.Add().Field(e => e.InActive).Editor("StatusType").Width(100) ;
below is a partial view i added under the EditorTemplate folder
@model CodedValues
@(Html.Kendo().DropDownListFor(m => m)
.AutoBind(true)
.DataTextField("DisplayText")
.DataValueField("KeyText")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("GetTypes", "my"))
.ServerFiltering(true);
})
)
@Html.ValidationMessageFor(m => m)
Thanks in advance.
Assembly Reference "...\lib\KENDOUIMVC\2017.2.504.545\Kendo.Mvc.dll" was not updated properly. This usually happens when an assembly exists both in the GAC and in a local folder. Please, use the GAC reference instead.
How do I only use the GAC? And what is the GAC ;)
Maurice
I am trying to use the events(e => e.Error("onError") in my grid that is ajax bound. I keep getting a javascript error "onError" is undefined. the grid is on a partial page that is loaded via ajax call.
when I put the script in the main view the onError function runs event if there is no error thrown. if I put it in a document ready function I get undefined.
not sure what to do.
index view
@model Jlo4MVC.Models.UserToSend
@{
ViewBag.Title =
"JLO"
;
}
<div id=
"userinput"
class
=
"row"
>
<ul
class
=
"userrentry"
>
<li>
@Html.Label(
"User ID"
)
@Html.Kendo().TextBox().Name(
"searchuserid"
)
</li>
<li>
@Html.Kendo().Button().Name(
"findUser"
).Content(
"Search for Sessions"
).HtmlAttributes(
new
{ @
class
=
"k-button"
})
</li>
</ul>
</div>
<div id=
"sessionsfound"
class
=
"row grid-centered"
style=
"display:none"
>
</div>
<div id=
"status"
class
=
"row grid-centered"
style=
"display:none"
>
</div>
<script type=
"text/javascript"
>
$(document).ready(function(){
function onError(e) {
alert(
"Some Error"
);
}
})
$(
'#findUser'
).click(function () {
var myurl =
'@Url.Action("getSessionsView", "home")'
;
var model = { userID: $(
"#searchuserid"
).val() };
$(
'#userinput'
).css(
"display"
,
"none"
);
$(
'#sessionsfound'
).css(
"display"
,
"block"
);
$.ajax({
url: myurl,
type:
"POST"
,
datatype:
"html"
,
data: model,
success: function (data) {
$(
'#sessionsfound'
).html(data);
}
});
});
</script>
Partial view
@model Jlo4MVC.Models.UserToSend
<div>
@(Html.Kendo().Grid<Jlo4MVC.Models.SessiondataDTO>()
.Name(
"VSM_Grid"
)
.NoRecords(
"NO Sessions Found"
)
.Columns(c =>
{
c.Template(t => { }).ClientTemplate(
"<input type='checkbox' class='checkbox' />"
);
c.Bound(i => i.id).Title(
"ID"
).Width(10);
c.Bound(i => i.farmName).Title(
"Farm"
).Width(25);
c.Bound(i => i.domainName).Title(
"Domain"
).Width(25);
c.Bound(i => i.applicationName).Title(
"App Name"
).Width(75);
c.Bound(i => i.serverName).Title(
"Server"
).Width(25);
c.Bound(i => i.sessionID).Title(
"Session ID"
).Width(10);
c.Bound(i => i.userID).Title(
"User ID"
).Width(40);
})
.DataSource(data => data
.Ajax()
.Events(events => events.Error(
"onError"
))
.Model(m => m.Id(p=>p.id))
.Read(read => read.Action(
"sessionsread"
,
"Home"
,
new
{userID = Model.userID})))
)
</div>
<div id=
"imentry"
class
=
"userrentry-gridsession"
>
<label
for
=
"tbIMnumber"
class
=
"required"
>Incident Number</label>
<input type=
"text"
id=
"imnum"
name=
"tbIMnumber"
class
=
"k-textbox"
placeholder=
"Incident num"
required validationmessage=
"Enter a valid Incident ID"
style=
"width: 220px;"
/>
</div>
<div
class
=
"kbutton-centered"
>
@Html.Kendo().Button().Name(
"endselected"
).Content(
"End Sessions"
).HtmlAttributes(
new
{ @
class
=
"k-button"
})
</div>
<div id=
"showErrors"
style=
"display:none"
>
</div>
<script>
var checkedvalues = [];
var jsonObj = [];
$(function () {
var validator = $(
"#imentry"
).kendoValidator().data(
"kendoValidator"
);
var myurl =
'@Url.Action("SessionsEnded", "home")'
;
$(
"#endselected"
).click(function () {
if
(validator.validate()) {
var imnum = $(
'#imnum'
).val();
var datatosend = {
imnumber: imnum,
sessionDTO: jsonObj
};
$(
'#sessionsfound'
).css(
"display"
,
"none"
);
$(
'#status'
).css(
"display"
,
"block"
);
$.ajax({
url: myurl,
type:
"POST"
,
datatype:
"html"
,
data: datatosend,
success: function (data) {
$(
'#status'
).html(data);
}
});
}
});
var grid = $(
"#VSM_Grid"
).getKendoGrid();
grid.table.on(
"click"
,
".checkbox"
, selectRow);
})
function selectRow() {
var
checked
=
this
.
checked
,
row = $(
this
).closest(
"tr"
),
grid = $(
"#VSM_Grid"
).data(
"kendoGrid"
),
dataItem = grid.dataItem(row);
jsonObj.push(dataItem);
//checkedvalues[dataItem.userID] = checked;
if
(
checked
) {
//-select the row
row.addClass(
"k-state-selected"
);
}
else
{
//-remove selection
row.removeClass(
"k-state-selected"
);
}
}
</script>
public
class
HomeController : Controller
{
[HttpGet]
public
ActionResult JLO()
{
UserToSend usertoSend =
new
UserToSend();
return
View(usertoSend);
}
public
ActionResult sessionsread([DataSourceRequest] DataSourceRequest request, UserToSend usertosend)
{
List<SessiondataDTO> sdto =
new
List<SessiondataDTO>();
sdto.Add(
new
SessiondataDTO { applicationName =
"testapplication"
, farmName =
"testFarm"
, domainName =
"MS"
, id = 1, serverName =
"server01"
, userID = usertosend.userID, sessionID = 01 });
sdto.Add(
new
SessiondataDTO { applicationName =
"testapplication4"
, farmName =
"testFarm"
, domainName =
"MS"
, id = 2, serverName =
"server02"
, userID = usertosend.userID, sessionID = 18 });
sdto.Add(
new
SessiondataDTO { applicationName =
"testapplication3"
, farmName =
"testFarm"
, domainName =
"MS"
, id = 3, serverName =
"server12"
, userID = usertosend.userID, sessionID = 15 });
sdto.Add(
new
SessiondataDTO { applicationName =
"testapplication7"
, farmName =
"testFarm"
, domainName =
"MS"
, id = 4, serverName =
"server00"
, userID = usertosend.userID, sessionID = 8 });
//List<SessionData> sessiondatas = new List<SessionData>();
//FarmInterfaceserviceClient svc = new FarmInterfaceserviceClient();
//SessiondataDTO sessiondatadto = new SessiondataDTO();
//List<SessiondataDTO> sdto = sessiondatadto.sessiondataTOSessionDTO(svc.GetSessionData(usertosend.userID));
DataSourceResult result = sdto.ToDataSourceResult(request);
return
Json(result, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public
ActionResult getSessionsView(UserToSend usertosend)
{
return
PartialView(
"_GetSessionsView"
, usertosend);
}
When I put code in the onRender(e) event, the OnRender event keeps firing causing stack overflow errors.
What I've succeeded in doing is:
loading my model (Columns A-N)
What I'd like to do after the model has loaded is:
1. Disable columns A:B
2. Add formulas in Columns (O-Q)
How do I do this?
Hi,
I am using a Custom Editor Template for my Scheduler grid. When saving details of an Event is there a way of ensuring that the user does not click the Submit button multiple times? The issue is the validation operations on the server that are taking a few seconds to complete.
Is there a way to display a progress bar for any server operations that are occurring?
Cheers.
Phil
hello telerik team.
can i customize the whole look and feel of gantt chart for mvc ? i want to have my own styling look and feel. I dont want to use the provided one. is that possible ?