Hi,
I'm trying to implement a custom command on my grid, which is using server binding, but the button just leads to a 'resource not found' error. My routing looks as it should and I can't see anything else wrong. I should also say that the MVC stuff is actually implemented in an 'area'. All my code is below, could anyone help?
Routing
1.
context.MapRoute(
2.
"ControlPanel_default"
,
3.
"ControlPanel/{controller}/{action}/{id}"
,
4.
new
{ action =
"Index"
, id = UrlParameter.Optional }
5.
);
Index.cshtml
01.
@(Html.Kendo().Grid(Model)
02.
.Name(
"Grid"
)
03.
.Columns(col =>
04.
{
05.
col.Bound(p => p.CustomerId);
06.
col.Bound(p => p.aspNetUserID);
07.
col.Command(cmd =>
08.
{
09.
cmd.Edit();
10.
cmd.Custom(
"Test"
).Action(
"Lockout"
,
"Index"
);
11.
});
12.
})
13.
.Editable(edt => edt.Mode(GridEditMode.PopUp))
14.
.Pageable()
15.
.Sortable()
16.
.Scrollable()
17.
.DataSource(ds => ds
18.
.Server()
19.
.Model(mdl => mdl.Id(p => p.CustomerId))
20.
.Read(
"Index"
,
"Index"
)
21.
.Update(
"Update"
,
"Index"
)
22.
.Create(
"Create"
,
"Index"
)
23.
.Destroy(
"Destroy"
,
"Index"
))
24.
)
IndexController.cs
01.
public
class
IndexController : Controller
02.
{
03.
public
ActionResult Index()
04.
{
05.
ViewBag.Title =
"Home"
;
06.
return
View(GetCustomers());
07.
}
08.
public
ActionResult Lockout(
int
CustomerId)
09.
{
10.
if
(ModelState.IsValid)
11.
{
12.
//var result = CustomerId;
13.
RouteValueDictionary routeValues =
this
.GridRouteValues();
14.
return
RedirectToAction(
"Index"
, routeValues);
15.
}
16.
return
View(
"Index"
);
17.
}
18.
}
Hi,
I'm using a AutoComplete in my form (Grid Popup Editor template) and all the Validation works except that on the AutoComplete...(see Picture)
here is the Code for the AutoCompleteFor:
<
div
class
=
"form-group m-xs"
>
<
label
class
=
"col-sm-2 control-label"
>Postleitzahl:</
label
>
<
div
class
=
"col-sm-2"
>
@(Html.Kendo().AutoCompleteFor(m => m.Postleitzahl)
.DataTextField("Postleitzahl_ID")
.Filter(FilterType.StartsWith).MinLength(1)
.NoDataTemplate("Keine Postleitzahl gefunden")
.Suggest(true)
.Height(300)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Postleitzahl_Read", "Standorte")
.Data("onAdditionalData");
})
.ServerFiltering(true);
})
.Events(e => e
.Select("onPostleitzahlSelect")
))
@Html.ValidationMessageFor(model => model.Postleitzahl)
</
div
>
here the part of the model class:
[Required]
[StringLength(8)]
public
string
Postleitzahl {
get
;
set
; }
[Required]
[StringLength(65)]
public
string
Ort {
get
;
set
; }
[Required]
[StringLength(255)]
Hi,
We allow users to change the the value in each cells. However, the user doesn't like to see the width changes from displaying text to a textbox mode. Is there any way we can stop it so we keep the same width for the displaying text and textbox?
thanks!
Hello,
After spending a couple of hours trying to figure out why my custom popup editor template was failing with this javascript error in the kendo.all.min.js file: "0x800a03f1 - JavaScript runtime error: Expected '}' "
it turned out to be an inline javascript comment that was causing the error. I have a script tag at the top of my template with a couple of javascript functions and in them are some single-line comments using the '//' syntax. When I remove those the popup editor works just fine and when I put them back in it throws the error. Why is this happening? Is this a known issue? Is it documented anywhere?
Thanks,
Mike
I have a grid which looks good on until 1400 screen resolution but if i try to go less than that, i don't see right most columns. I don't want to use vertical scroll bar, so I have used this
.Scrollable(s => s.Height("auto"))
But even this, slight changed my grid look. column width changed. I have attached some screen shots so that you can see the difference
Hi,
robert
I have an issue when i tried to show more than one grid in the view.
This is my first grid that works fine.
@model IEnumerable<CampeonatoFutbol.Models.PartidoClub>
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.ClubDesc).Title("EQUIPO").Width(220);
columns.Bound(c => c.PrtidoCodigo).Title("PJ").Width(60);
columns.Bound(c => c.GolesClub).Title("GC").Width(60);
columns.Bound(c => c.PuntosClub).Title("PUNTOS").Width(150);
})
.HtmlAttributes(new { style = "height: 300px;" })
.Scrollable()
.Reorderable(reorder => reorder.Columns(true))
.Pageable(pageable => pageable
.PageSizes(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
)
)
And this the method action of the controller that render the html of that grid.
public ActionResult Campeonato()
{
//return a list for the grid
}
and whe i tried to put another grid in the same view, the second grid doesn´t show me anything
This is the second grid that i tried to use:
@(Html.Kendo().Grid<CampeonatoFutbol.Models.PartidoClub>()
.Name("gridGoleadores")
.Columns(columns =>
{
columns.Bound(c => c.NombreJugador).Title("JUGADOR").Width(220);
columns.Bound(c => c.ClubDesc).Title("EQUIPO").Width(60);
columns.Bound(c => c.GolesJugador).Title("GOLES").Width(60);
})
.HtmlAttributes(new { style = "height: 300px;" })
.Scrollable()
.Reorderable(reorder => reorder.Columns(true))
.Pageable(pageable => pageable
.PageSizes(true))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GoleadoresCampeonato", "Campeonato"))
.PageSize(20)
)
)
And this is the method action that it's never called:
public ActionResult GoleadoresCampeonato([DataSourceRequest]DataSourceRequest request)
{
return Json(list.ToDataSourceResult(request) )
}
I hope someone can helpme whit this.
Requirements |
|
Telerik Product and Version |
2014.3.1411.440 |
Supported Browsers and Platforms |
GoogleChrome |
Components/Widgets used (JS frameworks, etc.) |
UIGrid |
PROJECT DESCRIPTION
[enter description here, together with step-by-step instructions on how to use the project]
We have several pages where we have noticed that the sorting of the grid is not working. We are attempting to sorty by four columns but to no luck we are able to get the desired results.. Attached is a sample of the binding as well as the controller method that retrieves the method.
I have tried binding it both in the controller using OrderBy, ThenBy extensions as well as the sort in the grid binding. Additionally I have also sorted the results within the method that the controller calls and have reviewed it with LinqPad and it appears to be sorting correctly. However I cannot get it bind sorted in the grid. Any help will be appreciated.
Grid Binding
Scrollable(a => a.Height("auto"))
.Sortable()
.PrefixUrlParameters(false)
.Filterable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(new[] { 50, 100, 250, 500, 1000 })
.Messages(messages => messages.ItemsPerPage(" items are currently displayed"))
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Server().PageSize(250)
.Sort(s =>
{
s.Add(c => c.EAN).Ascending();
s.Add(c => c.IngramSku).Ascending();
s.Add(c => c.BusinessYear).Descending();
s.Add(c => c.BusinessMonth).Descending();
Controller Method Logic
var viewModel = new ViewModels.RAM.VendorQuarterlyRevenueViewModel()
{
VendorId = vendorId,
VendorName = GetVendorName(vendorId),
sort = sort,
filter = filter,
group = group,
ShowDataGrid = true,
ReportDate = new ViewModels.RAM.ReportDateViewModel()
{
BeginDate = beginDate,
EndDate = endDate,
MaxDate = maxDate,
MinDate = minDate,
},
VendorQuarterlyRevenueData = _ramReportRepository.GetVendorQuarterlyRevenue(_ramReportRepository.GetContext(), beginDate, endDate, vendorId)
};
if (dataSourceRequest.Filters != null)
{
viewModel.VendorQuarterlyRevenueData = (IQueryable<
VendorRevenueModel
>)viewModel.VendorQuarterlyRevenueData.Where(dataSourceRequest.Filters);
}
foreach (var item in viewModel.VendorQuarterlyRevenueData)
{
viewModel.FreightRevenueSum += item.FreightRevenue;
viewModel.NetSalesSum += item.NetSales;
viewModel.RentalIncomeSum += item.RentalIncome;
}
return View("VendorQuarterlyRevenueReport", viewModel);