Telerik Forums
UI for ASP.NET MVC Forum
8 answers
226 views

Can UI for ASP.NET MVC Window be resized?

I want to make Window resizable by dragging its border, like Windows Explorer' s form. Is it possible?

Dan
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 24 Nov 2017
1 answer
163 views

Hi,

I am using a DataTable to automatically generate grid columns as in the "binding-to-datatable" example.  This is working well, but I can't figure out how to create a dropdown list for a given known column. 

 

Prior to autogenerating the columns, I would use "EditorTemplateName" to specify the editor template.  Can this be done with autogenerated columns, and if so, how? Is there an example of this being done?

 

Thanks in advance,

Ryan

Stefan
Telerik team
 answered on 23 Nov 2017
3 answers
535 views

When using RowTemplate, the html output contains empty rows (see attachments, marked items in yellow) which I can't find the option to no render them.

Grid:

@(Html.Kendo().Grid<ePower.Mvc.Areas.PM.Models.ObjectiveListData>(Model.Data)
.Name("ObjectiveListView")
.Columns(columns =>
{
columns.Bound(c => c.Item1).Visible(Model.Item1Used).Title(Model.Item1Header);
columns.Bound(c => c.Item2).Visible(Model.Item2Used).Title(Model.Item2Header);
columns.Bound(c => c.Employees).Title(EPower.Utils.Web.Configuration.WebSettings.Settings.LabelManager.GetString("PM_TeamObjective_ObjectiveListView_EmployeeHeader"));
columns.Bound(c => c.Item4).Visible(Model.Item4Used).Title(Model.Item4Header);
})
.RowTemplate(template =>
@<text>
<tr>
@if (Model.Item1Used)
{
<td>@item.Item1</td>
}
@if (Model.Item2Used)
{
<td>
<div class="item2">@item.Item2</div>
<div class="item3">@item.Item3</div>
</td>
}
<td>@Html.Raw(item.Employees)</td>
@if (Model.Item4Used)
{
<td>@item.Item4</td>
}
</tr>
</text>)
.NoRecords(EPower.Utils.Web.Configuration.WebSettings.Settings.LabelManager.GetString("PM_TeamObjective_ObjectiveListView_NoResult"))
)

 

Konstantin Dikov
Telerik team
 answered on 23 Nov 2017
1 answer
405 views

How to force the grid item into a single line stop text from wrapping ?

+ ---------------------------------------------------------+
|  column 1 | column 2 |  column 3
+ ---------------------------------------------------------+

|  data 1     | data 2 .... |  data 3
+ ---------------------------------------------------------+

instead of:

+ -------------------------------------------+
| column 1 |column n | column 3
+ -------------------------------------------+

|  data 1     | data 2  t|  data 3

|                 | testing  | 
+ ---------------------------------------------------------+

Please see the screenshot
Stefan
Telerik team
 answered on 23 Nov 2017
1 answer
168 views

I am currently refreshing the grid every 3 seconds on my page using the Javascript SetInterval function.  The grid is then reloading and displaying accurate information.  However, while the load is happening the grid flashes and looks disabled, then when the function returns it appears enabled again.   This is happening every three seconds so the grid is constantly flashing enabled/disabled.   Is there any way to override this functionality or CSS is can change? 

 

      setInterval(function () {
            var grid = $("#statistics").data("kendoGrid");
            if (grid != null) {
                grid.dataSource.read();
            }
        }, 3000);

 

 

Stefan
Telerik team
 answered on 23 Nov 2017
4 answers
1.5K+ views

Hello!

I have posted the question before and I thought that I managed to fix the issue but it turns out that I made a mistake. I contacted the support but we still haven't figured out how to fix the problem. I also think that it is pretty hard to understand the issue so I am posting it here and I hope that someone will be able to help.

Basically I have 2 grids on one screen. One shows the Positions in a company, the other shows the staff and their positions. So far so good. The staff grid has a foreign key to the positions table because you know these positions change and they can be updated, so our staff model only holds an id of the specific position. Both Grids are on the same screen and are ajax bound. I have a mechanism that refreshes both grids if there is a change. (dataSource.read() does the trick). I have attached scheme.

I do not want to refresh the screen. I saw from a demo in the docs that when I have a foreign key to some table the Grid uses ViewData to pass the values and map them to their specific Ids. A problem occurs when I edit the Position name in the first grid (the positions grid) and try to refresh the second one (the staff grid). As the staff grid holds only the id of the postion and as we cannot update the ViewData without refreshing the screen, the value remains the same even after I refresh the staff grid. I can edit the staff and change their positions but if I edit the grid from the positions grid, the changes are not visible in the staff gird without refreshing.

 

I have popup edit mode enabled with custom editor for the staff gird and there is a drop down for the foreign key column (postion name) which is beign updated when I refresh the grid and thats fine (it is bound to ajax so we don't have problem here). We need the foreign key columns Ajax bound, not ViewData bound. Of course I could edit my model and add a extra field to hold my Position title and pass it to the screen and use it instead of foreign key but that's not the idea.

 

I repeat:

  • I don't want to refresh the page.
  • I have attached a scheme.

 

Here is some source code that I use:

View (only the staff grid, that's what's important):

@(Html.Kendo().Grid<Models.Staff>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.ForeignKey(p => p.PositionId, (System.Collections.IEnumerable)ViewData["positions"], "Id", "PositionName");
    })
    .ToolBar(toolBar =>
        {
            toolBar.Create();
        })
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .Filterable()
    .Groupable()
    .Pageable()    
    .Scrollable() 
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(100)
        .ServerOperation(false)
        .Read(read => read.Action("Staff_Read", "Staff"))
        .Update(update => update.Action("Staff_Update", "Staff"))
        .Create(create => create.Action("Staff_Create", "Staff"))
    )
)

 

Controller(the index method that fills the ViewData):

public ActionResult Index ()
{
    ViewData["positions"] = context.Positions.Select(position => new
    {
        Id = position .Id,
        PositionName = position.PositionName
    });
    return View();
}

 

Hope I explained it good enough and someone could help me.

Kind Regards,
Kaloyan Manev

Viktor Tachev
Telerik team
 answered on 23 Nov 2017
1 answer
130 views

We have a Telerik UI for MVC grid in a partial view. When we attempt to drag a column header to use as a group, it appears offset from the mouse cursor by quite a lot.  I am assuming that it has something to do with the DIV we have as a header and whatever the offset is normally set for the dragged control.

So really my question is not so much why it happens, but where (and how) I can go about fixing the problem.

If there is a specific CSS or JS file we should be looking in to modify this behavior, please let me know.

TIA,

Mark

Stefan
Telerik team
 answered on 23 Nov 2017
4 answers
285 views

Hello,

 

I stumbled onto some behaviour that I think is wrong, but am not sure. In this dojo: https://dojo.telerik.com/eyOJA I have created a small snippet that displays the week number of 31.12.2017. That comes up as 1. I was expecting, depending on the culture, maybe an answer of 52 or 53, but certainly not 1. Am I missing something or is there a bug in the weekInYear?

Nencho
Telerik team
 answered on 23 Nov 2017
3 answers
710 views

Hey! i am using telerik listview Template for asp.net MVC i want to filter data from server side i.e i enter data in textbox send to action method and filter data and than pass to again view and bind data to listview initially my listview working perfect all data come through database here is my Code

<script type="text/x-kendo-tmpl" id="template">
    <div class="col-md-8  jumbotron">
        <div class="col-sm-4">
            <span><b>Name:</b></span><br />
            <span><b>Gender:</b></span><br />
            <span><b>DOB:</b></span><br />
            <span><b>Country:</b></span><br />
            <span><b>Province:</b></span><br />
            <span><b>Interset:</b></span><br />
        </div>
        <img img src="#:Image#" width="100" height="100" />
        <div class="col-sm-4">
            <span>#:FirstName#</span><br />
            <span>#:Gender#</span><br />
            <span>#:DOB#</span><br />
            <span>#:CountryName#</span><br />
            <span>#:ProvinceName#</span><br />
            <span>#:Interset#</span><br />
        </div>
    </div>
</script>

<div class="demo-section k-content wide">
    @(Html.Kendo().ListView<Assignment.Models.StudentViewModel>()
                .Name("ListView")
                .TagName("div")
                .ClientTemplateId("template")
                .DataSource(dataSource => dataSource
                .ServerOperation(true)
                .Read(read => read.Action("Get", "Home")
                )
                )
    )
</div>

// here im getting data from server for first load using store procedure now i need to filter data from server side in action method 

public JsonResult Get([DataSourceRequest] DataSourceRequest request)
        {
            var studentData = db.sp_GetStudentData().Select(list => new StudentViewModel
            {
                FirstName = list.FirstName,
                Gender = list.Gender,
                DOB = list.DOB.Value.ToShortDateString(),
                Image = list.Image,
                CountryName = list.Name,
                ProvinceName = list.ProvinceName,
                Interset = list.Interset
            }).ToList();
            return Json(studentData.ToDataSourceResult(request));
        }

Stefan
Telerik team
 answered on 22 Nov 2017
4 answers
232 views

I've got the tooltip showing on click, but I cannot access any of the variables from my datasource read method in the template. I either get undefined, or errors when trying different combinations with the template. 

 

<script id="Map_Tooltip_Template" type="text/x-kendo-template">
        <p>#=latlng#</p>
</script>

Max
Top achievements
Rank 2
 answered on 21 Nov 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?