or
Hello,
Is is possible to set the height of a row after the databound ?
Let me explain why. Sometimes I have a lot of events and sometimes I don't. So I want to set the height of the row after the databound so I can show all the event in the row. The attached file will clarify my mind I think.
Thanks in advance for your response.
@(Html.Kendo().Editor() .Name("Body") .HtmlAttributes(new { style = "width: 590px;height:440px" }) .Value(@Model.Body))@(Html.Kendo().Grid<FareDetailViewModel>() .Name("fare_details#=FareID#") .ToolBar(t => { if (User.IsInRole("Modify")) { t.Create().Text("Afegir Referencia"); } }) .Columns(columns => { columns.ForeignKey(f => f.Tipus, (System.Collections.IEnumerable)ViewBag.CatalogTypes, "Key", "Value").EditorTemplateName("CustomGridForeignKeyFareType").Width(120); //columns.ForeignKey(f => f.CatalogReference, (System.Collections.IEnumerable)ViewBag.Cataleg, "Reference", "Descripcio").EditorTemplateName("CatalegReferenceByType"); columns.Bound(f => f.CatalogReference).EditorTemplateName("CatalegReferenceByType").EditorViewData(new { gridid = "fare_details#=FareID#" });@model object@(Html.Kendo().DropDownList() .Name("CatalogReference" + ViewData["gridid"]) .HtmlAttributes(new { data_bind = "value:CatalogReference" }) .AutoBind(false) .OptionLabel("Select reference...") .DataTextField("Descripcio") .DataValueField("Reference") .Filter(FilterType.Contains) .MinLength(3) .ValuePrimitive(true) //.HtmlAttributes(new { data_skip = "true", data_bind = "defferedValue: object" }) //.BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"]) .DataSource(source => { source.Read(read => read.Action("PopulateReferences", "Catalog").Data("filterTypes")) .ServerFiltering(true); }) .CascadeFrom("Tipus") .HtmlAttributes(new { id = Guid.NewGuid().ToString() }))function filterTypes() { return { text: $("#Type").data("kendoDropDownList").value() + "|" + $("#CatalogReference" + temporalFare).data("kendoDropDownList").filterInput.val() }; }public JsonResult PopulateReferences(string text) { var param = text.Split('|'); var type = (int)text[0]; var search = text[1]; var catalog = GetCatalog((catalogType)type).Where(c => (c.Descripcio + " " + c.Reference).Contains(search)).Select(c => new { Reference = c.Reference, Descripcio = c.Descripcio + " - " + c.Reference }).AsQueryable(); return Json(catalog, JsonRequestBehavior.AllowGet); }public class LotViewModel
{
public int LotId { get; set; }
[Display(Name = "Level")]
[Range(1, 2)]
[UIHint("LotLevel")]
public int Level { get; set; }
}@(Html.Kendo().Grid<LotViewModel>() .Name("lotGrid") .Columns(columns => { columns.Bound(x => x.LotId).Visible(false); columns.Bound(x => x.Level); columns.Command(command => { command.Edit(); }).Width(100); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.InLine)) .AutoBind(true) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(m => m.LotId); model.Field(m => m.Level).DefaultValue(1); }) .Read(update => update.Action("GetLots", "Lot")) .Create(update => update.Action("CreateLot", "Lot")) .Update(update => update.Action("UpdateLot", "Lot")) ) )@model int@{; var levelOne = Model.Equals(1) ? "active btn-primary" : null; var levelTwo = Model.Equals(2) ? "active btn-primary" : null; var htmlField = ViewData.TemplateInfo.HtmlFieldPrefix;}@Html.HiddenFor(model => model)<div class="btn-group btn-group-@htmlField"> <button type="button" class="btn btn-default @levelOne bool-@htmlField" onclick="javascript: setValue(this, 1);"> Level 1 </button> <button type="button" class="btn btn-default @levelTwo bool-@htmlField" onclick="javascript:setValue(this, 2);"> Level 2 </button></div><script> function setValue(button, level) { $('.btn-group-@htmlField button.active').removeClass('active btn-primary'); $(button).addClass('active btn-primary'); $('#@htmlField').val(level); // TODO: Set the value of the model here }</script>