or
$.ajax(
{
url: '@Url.Action("GetThrowData", "UserConsoleViewModels")',
type: 'POST',
dataType: 'json',
data:
{
throwId: _throwId
}
}
).done(
function (response) {
console.log(response);
$("#direction").text(response.Data.Action);
$("#lblRawData").text(response.Data.RawData);
}
).error(
function (xhr, status, error) {
alert(xhr.responseText);
}
);
@(Html.Kendo().Chart()
.Name("currentGraph")
.Title("Switch Current Graph")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0}"))
.Title("Current")
).HtmlAttributes(new { style = "height:300px" })
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0}")
)
)
[DisplayName("Activate Date")]
public DateTimeOffset? activateDate { get; set; }
[DisplayName("Inactivate Date")]
public DateTimeOffset? inactivateDate { get; set; }
[DisplayName("Energizing Date")]
public DateTimeOffset? energizingDate { get; set; }
var x = dao.CONNECTIVITY_UNIT
.Join(dao.OP_AREA_ORG, cu => cu.OP_AREA_CODE, oa => oa.OP_AREA_CODE, (cu, oa) => new { CONNECTIVITY_UNIT = cu, OP_AREA_ORG = oa })
.Where(w => w.CONNECTIVITY_UNIT.UNIT_TYPE.Equals("SUBSTATION"))
.Where(w => w.CONNECTIVITY_UNIT.IS_ACTIVE_FLAG.ToUpper().Equals("Y"))
.Where(w => w.CONNECTIVITY_UNIT.ABBR.ToUpper().Equals("BRA"))
.Select(c => new SubstationVM
{
energizingDate = c.CONNECTIVITY_UNIT.ENERGIZING_DATE,
activateDate = c.CONNECTIVITY_UNIT.ACTIVATE_DATE,
inactivateDate = c.CONNECTIVITY_UNIT.INACTIVATE_DATE,
updateTime = c.CONNECTIVITY_UNIT.UPDATE_TMSTMP
})
.OrderBy(o => o.substationABBR)
.ToList();
return x;
<
div
class
=
"form-group"
>
@Html.LabelFor(model => model.energizingDate, new { @class = "control-label col-xs-2" })
<
div
class
=
"col-xs-2"
>
@Html.EditorFor(model => model.energizingDate)
@Html.ValidationMessageFor(model => model.energizingDate)
</
div
>
<
div
class
=
"col-xs-3"
>
<
div
class
=
"form-group"
>
@Html.LabelFor(model => model.activateDate, new { @class = "control-label col-xs-4" })
<
div
class
=
"col-xs-7"
>
@Html.EditorFor(model => model.activateDate)
@Html.ValidationMessageFor(model => model.activateDate)
</
div
>
</
div
>
</
div
>
<
div
class
=
"col-xs-3"
>
<
div
class
=
"form-group"
>
@Html.LabelFor(model => model.inactivateDate, new { @class = "control-label col-xs-4" })
<
div
class
=
"col-xs-7"
>
@Html.EditorFor(model => model.inactivateDate)
@Html.ValidationMessageFor(model => model.inactivateDate)
</
div
>
</
div
>
</
div
>
</
div
>
@(Html.Kendo().Grid<
AppUser
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.Name).Width(140);
columns.Bound(c => c.HomeAddress).Width(140);
columns.Bound(c => c.BizAddress).Width(140);
})
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Groupable()
.Sortable()
.Selectable()
.Events(events => events.Change("grid_change"))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("FilteredPeople_Read", "UserConsoleViewModels"))
)
)
<
script
>
function grid_change(e) {
var data = this.dataItem(this.select());
if (clickedColumnIndex != 0) // How do I find selectedColumnIndex?
{
$("#labelName").text(data.Name);
$("#labelAddress").text(selectedColumnIndex == 1 ? data.HomeAddress : data.BizAddress);
}
}
</
script
>
public static Kendo.Mvc.UI.Fluent.PanelBarBuilder MovementPanel(this HtmlHelper helper, string name, Boolean withContainer,string Controller, RouteValueDictionary export)
{
Kendo.Mvc.UI.Fluent.PanelBarBuilder myPanel = helper.Kendo().PanelBar()
.Name(name)
.ExpandAll(true)
.ExpandMode(PanelBarExpandMode.Multiple);
PanelBarItem itAction = new PanelBarItem();
itAction.Text = "Actions";
itAction.Items.Add(NewBarItem("Error detail","javascript:void(0)"));
itAction.Items.Add(NewBarItem("File content", "javascript:void(0)"));
PanelBarItem itExcel = new PanelBarItem();
itExcel.Text = "Excel export";
itExcel.Action("ExportToExcel", Controller, export);
itAction.Items.Add(itExcel);
if (withContainer)
{
itAction.Items.Add(NewBarItem("Container history", "javascript:void(0)"));
}
myPanel.ItemAction(ac => ac.Items.Add(itAction));
myPanel.Events(events =>
events.Select("OnSelectAction")
);
return myPanel;
}
private static PanelBarItem NewBarItem(string text, string url)
{
PanelBarItem itTemp = new PanelBarItem();
itTemp.Text = text;
itTemp.Url = url;
return itTemp;
}
<script id=
"template"
type=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<ZakresViewModel>()
.Name(
"podzakresy#=IdZakres#"
)
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.ToolBar(toolbar =>
{
toolbar.Create().Text(
"<span class=\"fa fa-plus\"></span> "
+ SettingsStrings.DodajNowyPodzakres).HtmlAttributes(
new
{ @
class
=
"btn btn-warning"
, idZakresNadrzedny =
"#=IdZakres#"
});
})
.Columns(columns =>
{
columns.Bound(c => c.Numer).Width(80).Title(SharedStrings.Numer);
columns.Bound(c => c.Nazwa).Title(SharedStrings.Nazwa);
columns.Command(command => command.Edit().UpdateText(SharedStrings.Zapisz).CancelText(SharedStrings.Anuluj).Text(SharedStrings.Edytuj)).Width(100);
columns.Command(command => command.Destroy().Text(SharedStrings.Usun)).Width(100);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Model(model => { model.Id(p => p.IdZakres); })
.Read(read => read.Action(
"GridPodzakresy_Read"
,
"Settings"
,
new
{ IdZakresNadrzedny =
"#=IdZakres#"
}))
.Create(create => create.Action(
"GridPodzakresy_PopupCreate"
,
"Settings"
,
new
{ IdZakresNadrzedny =
"#=IdZakres#"
}))
.Update(update => update.Action(
"GridZakresy_PopupUpdate"
,
"Settings"
))
.Destroy(delete => delete.Action(
"GridZakresy_PopupDestroy"
,
"Settings"
))
)
.Pageable()
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Sortable()
.ToClientTemplate()
)
</script>
@(Html.Kendo().Grid<ZakresViewModel>()
.Name(
"grid-zakresy"
)
.HtmlAttributes(
new
{ style =
"height:100%; cursor:default"
})
.ClientDetailTemplateId(
"template"
)
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.ToolBar(toolbar => toolbar.Create().Text(
"<span class=\"fa fa-plus\"></span> "
+ SettingsStrings.DodajNowyZakres).HtmlAttributes(
new
{ @
class
=
"btn btn-primary"
}))
.Columns(columns =>
{
columns.Bound(c => c.IdKontrakt).Visible(
false
).Filterable(
false
);
columns.Bound(c => c.IdZakres).Visible(
false
).Filterable(
false
);
columns.Bound(c => c.IdZakresNadrzedny).Visible(
false
).Filterable(
false
);
columns.Bound(c => c.Numer).Width(80).Title(SharedStrings.Numer);
columns.Bound(c => c.Nazwa).Title(SharedStrings.Nazwa);
columns.Command(command => command.Edit().UpdateText(SharedStrings.Zapisz).CancelText(SharedStrings.Anuluj).Text(SharedStrings.Edytuj)).Width(100);
columns.Command(command => command.Destroy().Text(SharedStrings.Usun)).Width(100);
})
.Pageable(pageable => pageable.Refresh(
true
).ButtonCount(3))
.Sortable(s => { s.AllowUnsort(
true
); s.SortMode(GridSortMode.MultipleColumn); })
.Scrollable(scr => { scr.Height(
"100%"
); scr.Enabled(
false
); })
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Model(model => { model.Id(p => p.IdZakres); })
.Read(read => read.Action(
"GridZakresy_Read"
,
"Settings"
,
new
{ IdKontrakt = Model.IdKontrakt }))
.Create(create => create.Action(
"GridZakresy_PopupCreate"
,
"Settings"
))
.Update(update => update.Action(
"GridZakresy_PopupUpdate"
,
"Settings"
))
.Destroy(delete => delete.Action(
"GridZakresy_PopupDestroy"
,
"Settings"
))
)
)
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult GridPodzakresy_PopupCreate([DataSourceRequest] DataSourceRequest request, ZakresViewModel zakres)
{
if
(zakres !=
null
&& ModelState.IsValid)
{
//some code
}
return
Json(
new
[] { zakres }.ToDataSourceResult(request, ModelState));
}
public
class
ExportData
{
public
DateTime startDate {
get
;
set
; }
public
DateTime endDate {
get
;
set
; }
public
string
exportType {
get
;
set
; }
}
@
using
Microsoft.AspNet.Identity
@
using
Kendo.Mvc.UI
@model InsulinCalculator.Models.ExportData
@
using
(Html.BeginForm(
"Export"
,
"Home"
, FormMethod.Post))
{
<div
class
=
"form-group"
>
<label
class
=
"col-md-2 control-label"
for
=
"dtpStartDate"
style=
"white-space:nowrap;"
>Start Date:</label>
<div
class
=
"col-md-3"
>
<div
class
=
"input-group"
>
@(Html.Kendo()
.DatePickerFor(model => model.startDate)
.Name(
"dtpStartDate"
)
.Format(
"MM/dd/yyyy"
)
.HtmlAttributes(
new
{ style =
"width:180px"
})
)
</div>
</div>
</div>
<div
class
=
"form-group"
>
<label
class
=
"col-md-2 control-label"
for
=
"dtpEndDate"
style=
"white-space:nowrap;"
>End Date:</label>
<div
class
=
"col-md-3"
>
<div
class
=
"input-group"
>
@(Html.Kendo()
.DatePickerFor(model => model.endDate)
.Name(
"dtpEndDate"
)
.Format(
"MM/dd/yyyy"
)
.HtmlAttributes(
new
{ style =
"width:180px"
})
)
</div>
</div>
</div>
<div
class
=
"form-group"
>
<label
class
=
"col-md-2 control-label"
for
=
"exportType"
style=
"white-space:nowrap;"
>Format:</label>
<div
class
=
"col-md-3"
>
@(Html.Kendo()
.DropDownListFor(model => model.exportType)
.Name(
"exportType"
)
.HtmlAttributes(
new
{ style =
"width:180px"
})
.BindTo(
new
List<
string
>()
{
"Microsoft Excel (XLSX)"
,
"Microsoft Word (DOCX)"
,
"Adobe Acrobat (PDF)"
})
)
</div>
</div>
<div
class
=
"form-group"
>
<div
class
=
"col-sm-4"
>
<input type=
"submit"
value=
"Export Data"
class
=
"btn btn-sm bg-purple2 pull-right"
>
</div>
</div>
}
[Authorize]
[HttpPost]
public
ActionResult Export(ExportData oData)
{
Response.Write(oData.startDate +
" "
+ oData.endDate +
" "
+ oData.exportType);
return
View();
}