I'm trying to render a grid on demand in a tab using the nw component views. I have tried the following but non work.
@(Html.Kendo().TabStrip().Name("tabstripx").Items(tabstrip =>
{
tabstrip.Add().Text("Tab1").Content(
@<
text
>
@Component.InvokeAsync("SupplierCompliance", new { SupplierId = Model.Id })
</
text
>);
tabstrip.Add().Text("Tab1").Content(@<
text
>
<
vc:supplier-compliance
id
=
"3"
></
vc:supplier-compliance
>
</
text
>);
}))
Hello-
I am having an issue accessing my ICollection <Image> Images in the ClientTemplate. It is accessible from the kendo datasource, but not in the ClientTemplate script; however, all of other variables of a different type from my class are accessible. The Image class has a member of type string called "name". My script to access that variable is below. When I load this page, the ListView comes up empty.
<script type=
"text/x-kendo-tmpl"
id=
"template"
>
<div id=
"product"
>
<dl id=
"itemDetails"
>
<dt>ImageName:</dt>
<dd>
#:Images[0].Name#</dd>
</dl>
</div>
</script>
How I successfully access the variable from the dataSource:
function
x () {
var
index =
this
.select().index();
var
dataItem =
this
.dataSource.view()[index];
$(
"#ImageName"
).html(dataItem.Images[0].name);
}
How does my syntax need to change to access it in the ClientTemplate script?
Thank you for the help,
S
Hi,
I am new to Telerik controls. I am trying to bind grid to datasource, not sure what am I doing wrong but grid is always empty.
Here is some sample code.
public IActionResult Index(string YYYYQ)
{
var initialYYYYQ = YearAndMonth.AbstractStartYearMonth();
SelectedMeasuresViewModel sModel = GetMeasureSelectionData(initialYYYYQ);
return View(sModel);
}
public ActionResult MeasureSelections_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(GetMeasureSelectionData("2017-02"));
}
private SelectedMeasuresViewModel GetMeasureSelectionData(string YYYYMM)
{
measureSelectionList = someData;
SelectedMeasuresViewModel sModel = new SelectedMeasuresViewModel();
sModel.SelectedYYYYMM = YYYYMM;
sModel.SelectedMeasureSets = measureSelectionList; (this is list of MeasureListData)
return sModel;
}
View is simple
@using (Html.BeginForm())
{
@Html.DropDownListFor(m => m.SelectedYYYYMM, YearAndMonth.MonthDropdownOptions(), new { onchange = "this.form.submit(); " })
@Html.Partial("MeasureSelections", Model.SelectedMeasureSets)
}
Partial View is
@(Html.Kendo().Grid<EncorI.Web.Areas.Admin.Models.MeasureListData>()
.Name("measureSelectionGrid")
.Columns(columns =>
{
columns.Bound(c => c.Enabled).Width(100);
columns.Bound(c => c.MeasureSetID).Width(100);
columns.Bound(c => c.MeasureSetName).Width(300);
columns.Bound(c => c.HospitalID).Width(100);
columns.Bound(c => c.HospitalName).Width(300);
})
.HtmlAttributes(new { style = "height: 850px;" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("MeasureSelections_Read", "measureSelectionGrid"))
.PageSize(20)
)
)
Is there a simple way to change the background color of the Month/Year view?
Thanks.
-------------------------------------------------------------------------------------------------------------
<telerik:RadDatePicker RenderMode="Lightweight" ID="FromScreeningDatePicker" runat="server" Width="120px"
ClientEvents-OnDateSelected="FromDateSelected"
Calendar-CalendarTableStyle-BackColor="White"
Calendar-TitleStyle-BackColor="White"
MinDate='<%# Convert.ToDateTime("01/01/1900")%>' MaxDate='<%# Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"))%>'
DbSelectedDate='<%# startDate %>' FocusedDate="01/01/2016">
</telerik:RadDatePicker>
How do I get the resource (RoomID) from an associated click event:
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.wrapper.on("click touchend", " .k-scheduler-content td", function (e) {
var slot = scheduler.slotByElement(e.originalEvent.target);
if (slot) {
alert(slot.startDate);
alert(slot.endDate);
alert(slot.resources.RoomID);?????
}
});
Hi,
I'm binding a grid to a collection of my model and when that collection is empty the grid is making a post to get data.
Trying to avoid that useless ajax requests I set AutoBind(false) but when I return a collection with data the grid do not bind it.
How can I prevent the request event if there is no initial data?
I have a grid and I am doing ajax batch updates using the following methods in my controllers with Entity Framework. This is working fine.
http://docs.telerik.com/aspnet-mvc/helpers/grid/editing/batch-editing
Do you have a controller code example (hard to find on the net) to perform the same type of batch update but with a many-to-many db relationship as I have added a multiselect component on my grid?
This is a follow up of my post here
Hello,
I have a problem with the listview widget, that occurs just in IE11.
Please open the demo: http://demos.telerik.com/aspnet-core/listview/keyboard-navigation
Run this command in the console: $('#main').css({ height: 400, overflow: 'auto' }).find('.product-view.k-widget').on('click', function () { alert('clicked'); });
What we do: Set the main area to a small height and set it scrollable. Add click listener to all items and show an alert on click.
If you now click on an item, everything is working as expected. Now scroll down with $('#main').scrollTop(700); and try to click one of the bottom items of the list. In this moment the widget gets the focus and scrolls to its beginning, but the click is not registered. In my application I also have a scrollable container with a listview inside and I need to register item clicks. Our application MUST work in IE11, because our customer is just using IE. It would be great if you analyze the problem and fix it in the future. For now I definately need a workaround asap. Thank you.
The DateInput server side wrapper does not appear to work with nullable DateTimes. In the below code, if 'TaxDate' is a nullable DateTime when the page is rendered the control will always display 'month/day/year' (as it does when the value is null) even if the value being passed to it isn't null.
I tried setting the .value() property on the control but it does not accept nullable DateTimes.
@(Html.Kendo().DateInput()
.Name("TaxDate")
.HtmlAttributes(new { style = "width:100%;", @class = "autoSelectText" })
From the demo page it looks as if null is a supported state, does the server side wrapper not support it?
Thanks,
Brian
HI All
I require the code behind in C# equivalent of the following asp.net code , could you help please.
<telerik:RadHtmlChart runat="server" ID="LineChart" Width="800" Height="500" Transitions="true">
<PlotArea>
<Series>
<telerik:LineSeries Name="Week 15" MissingValues="Interpolate">
<Appearance>
<FillStyle BackgroundColor="Blue" />
</Appearance>
<LabelsAppearance DataFormatString="{0}%" Position="Above" />
<MarkersAppearance MarkersType="Square" BackgroundColor="Blue" />
<SeriesItems>
<telerik:CategorySeriesItem Y="15" />
<telerik:CategorySeriesItem Y="23" />
<telerik:CategorySeriesItem />
<telerik:CategorySeriesItem Y="71" />
<telerik:CategorySeriesItem Y="93" />
<telerik:CategorySeriesItem Y="43" />
<telerik:CategorySeriesItem Y="23" />
</SeriesItems>
</telerik:LineSeries>
<telerik:LineSeries Name="Week 16" MissingValues="Gap">
<Appearance>
<FillStyle BackgroundColor="Red" />
</Appearance>
<LabelsAppearance DataFormatString="{0}%" Position="Above" />
<MarkersAppearance MarkersType="Square" BackgroundColor="Red" />
<SeriesItems>
<telerik:CategorySeriesItem Y="35" />
<telerik:CategorySeriesItem Y="42" />
<telerik:CategorySeriesItem Y="18" />
<telerik:CategorySeriesItem Y="39" />
<telerik:CategorySeriesItem Y="64" />
<telerik:CategorySeriesItem Y="10" />
<telerik:CategorySeriesItem Y="6" />
</SeriesItems>
</telerik:LineSeries>
</Series>
<XAxis MajorTickType="Outside" MinorTickType="Outside">
<Items>
<telerik:AxisItem LabelText="Monday" />
<telerik:AxisItem LabelText="Tuesday" />
<telerik:AxisItem LabelText="Wednesday" />
<telerik:AxisItem LabelText="Thursday" />
<telerik:AxisItem LabelText="Friday" />
<telerik:AxisItem LabelText="Saturday" />
<telerik:AxisItem LabelText="Sunday" />
</Items>
<MajorGridLines Color="#EFEFEF" Width="1" />
<MinorGridLines Color="#F7F7F7" Width="1" />
<TitleAppearance Position="Center" RotationAngle="0" Text="Days" />
</XAxis>
<YAxis MajorTickSize="1" MajorTickType="Outside" MaxValue="100" MinorTickSize="1"
MinorTickType="Outside" MinValue="0">
<LabelsAppearance DataFormatString="{0}%" RotationAngle="0" />
<MajorGridLines Color="#EFEFEF" Width="1" />
<MinorGridLines Color="#F7F7F7" Width="1" />
<TitleAppearance Position="Center" RotationAngle="0" Text="CPU Load" />
</YAxis>
</PlotArea>
<ChartTitle Text="Server CPU Load By Days">
</ChartTitle>
<Legend>
<Appearance Position="Bottom" />
</Legend>
</telerik:RadHtmlChart>