Telerik Forums
UI for ASP.NET MVC Forum
1 answer
55 views

Hi,

We are using a detail row on one of our grids, but have noticed that there are a couple of issues with the way we have done it and I am wondering if there is a way to do the following:

 1. When we re-order the columns on the main grid, re-order the same columns on the detail row.

 2. When we re-size the columns on the main grid, re-size them on the detail row.

 The problem is that we have hard coded the order currently, but are allowing the user the ability to re-order, thus presenting us with the issues above.

Is there an easy way of achieving the above, or will it be a case of manually manipulating them both with javascript?

Cheers,

Gareth

Nikolay Rusev
Telerik team
 answered on 26 Nov 2015
1 answer
93 views

Is there are document that maps the MVC Razor syntax to the raw Kendo UI notation?

 

I find several examples using Kendo UI that suit my needs but I need to convert them to run in an MVC project.

 

It's not always clear how the syntax matches from one to the other.

 

Thanks,

Ken

Kiril Nikolov
Telerik team
 answered on 26 Nov 2015
1 answer
144 views
 Hello, I am unable to get data into my kendo grid. I have looked at many other threads but nothing has helped so far. I want to get the data from my controller / model but I am not sure if i am trying to do it correctly
 

 VIEW

@model MyProject.Models.POApprovalViewModel 
 
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
@{
    ViewBag.Title = "PO Approval";
}
 
<div class="container">
    <h4>PO Approval</h4>     
 
    @(Html.Kendo().Grid(Model.AssignedApprovals)
              .Name("grdPOs")
              .Columns(columns =>
              {
                  columns.Bound(model => model.PoId);
                  columns.Bound(model => model.PoStatus);
              })
              .Pageable()
              .Sortable()
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .ServerOperation(true)
                  .Model(model => model.Id("PoId"))
                  .Read(read => read.Action("POApproval_Read", "POApproval"))
               )
    )
 
</div>

 

 CONTROLLER

public class POApprovalController : Controller
{
    string UserId;
    POApprovalViewModel po;
 
    // GET: POApproval
    public ActionResult Index()
    {
        po = new POApprovalViewModel();
        return View(po);
    }
 
    [HttpPost]
    public ActionResult POApproval_Read()
    {
        dbPOApproval db = new dbPOApproval();
        return Json(db.GetAssignedApprovals());
    }
}

 

MODEL

    public class POApprovalViewModel
   {
       public List<OLAssignedApprovals> AssignedApprovals
       {
           get
           {
               if (_AssignedApprovals == null)
               {
                   _AssignedApprovals = new List<OLAssignedApprovals>();
               }
               return _AssignedApprovals;
           }
       }
 
       private List<OLAssignedApprovals> _AssignedApprovals;
   }   
 
   public class OLAssignedApprovals
   {
       public int PoId { get; set; }
       public string PoStatus { get; set; }
   }
 
   public class dbPOApproval
   {
       MyDataSourceOjbect objPOApproval = new MyDataSourceOjbect();
 
       public List<Models.OLAssignedApprovals> GetAssignedApprovals()       
       {
           List<Models.OLAssignedApprovals> lPoApproval = new List<Models.OLAssignedApprovals>();
           Models.OLAssignedApprovals li = new Models.OLAssignedApprovals();
 
           DataSet ds = objPOApproval.GetPOApprovals();
 
           foreach (DataRow dr in ds.Tables[0].Rows)
           {
               li = new Models.OLAssignedApprovals();
               li.PoId = Convert.ToInt32(dr["POID"]);
               li.PoStatus = dr["POStatus"].ToString();
 
               lPoApproval.Add(li);
           }
 
 
           return lPoApproval;
       }
   }

Dimiter Madjarov
Telerik team
 answered on 25 Nov 2015
1 answer
104 views

When the user clicks Update the cell in the grid isn't being populated with the EditorTemplate hyperlink value.

EditorTemplate:
@(Html.Kendo().Editor()
.Name("EVIDENCE")
.HtmlAttributes(new { style = "width: 250px;height:25px" })
.Tools(tools => tools.Clear().CreateLink())
.Value(@<text> </text>)
)

view:
<div class="wide-grid">
@Html.AntiForgeryToken()
@(Html.Kendo().Grid(Model.TASKs)
.Name("TasksGrid")
.Columns(columns =>
{
columns.Command(command => { command.Edit(); }).Width(50);
columns.Bound(c => c.STATUS).Visible(false);
columns.ForeignKey(c => c.RESP_ORG_ID, (System.Collections.IEnumerable)ViewData["RespOrgs"], dataFieldText: "RESP_ORG_DESC", dataFieldValue: "RESP_ORG_ID").Title("Resp Org").Width("200px");
columns.ForeignKey(c => c.ACTIVITY_ID, (System.Collections.IEnumerable)ViewData["Activities"], dataFieldText: "ACTIVITY_DESC", dataFieldValue: "ACTIVITY_ID").Title("Activity");
columns.ForeignKey(c => c.SOURCE_DOC_ID, (System.Collections.IEnumerable)ViewData["SourceDocs"], dataFieldText: "SOURCE_DOC_DESC", dataFieldValue: "SOURCE_DOC_ID").Title("Source Doc").ClientTemplate("<a href='#=SOURCE_DOC_PATH#'>#=SOURCE_DOC_DESC#</a>").Width(125);
columns.ForeignKey(c => c.ROLE_ID, (System.Collections.IEnumerable)ViewData["Roles"], dataFieldText: "ROLE_DESC", dataFieldValue: "ROLE_ID").Title("Role");
columns.Bound(c => c.RESP_ORG_ID).Visible(false);
columns.Bound(c => c.ACTIVITY_ID).Visible(false);
columns.Bound(c => c.ROLE_ID).Visible(false);
columns.Bound(c => c.DOC_REF).Width(75);
columns.Bound(c => c.DUE_DATE).EditorTemplateName("DueDate").Width(75);
columns.Bound(c => c.COMPLETED).Width(75);
columns.Bound(c => c.TASK_DESC).EditorTemplateName("TaskDescription").Width(500);
columns.Bound(c => c.EVIDENCE).EditorTemplateName("TaskEvidence").Width(15);
columns.Bound(c => c.CTL_NO);
columns.Bound(c => c.ACQUISITION_ID).Visible(false);
})
.ToolBar(toolbar => toolbar.Create().Text("Add New Task"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.ServerOperation(false)
.Events(events => events.RequestEnd("requestEnd"))
.Model(model =>
{
model.Id(a => a.TASK_ID);
})
.Update(update => update.Action("Edit", "Task").Data("sendAntiForgery"))
.Read(read => read.Action("TaskGrid_Read", "Task", new { id = @Model.ACQUISITION_ID }))
.Create(create => create.Action("Create", "Task").Data("sendAntiForgery"))
)
)
</div>

Dimiter Madjarov
Telerik team
 answered on 25 Nov 2015
2 answers
133 views

Hi,

in former WebForm projects I was using asp:DropDownList mostly in these kind of scenarios:

1) The DL was fully rendered server side and the selectable values have been populated using Object/SQL/LinqDataSource on the server.

2) The DL was two-way-bound (by the Bind or Eval statement) to a property of an arbitrary data model, e.g. in the context of a ListView or FormView.

To give you an example of the use case: Say a "status" property in a model need to have values like "On", "Off", "Unknown" and nothing else. An ObjectDataSource ensured, that the DL only contained the values for selection. Then the real model was queried in order to find the selected value and that was selected after Page_Load automatically. Once the user changed the selected value in the "status" DL, the new value was posted back to the server.

That worked fine.

I know how to achieve 1) in the "Kendo World", but I'm wondering, how I could simultaneously "two-way-bind" the DL to another model in order to set the "SelectedItem" form another data model as well as to POST finally changes made by the user.

Any pointer welcome

TIA

Neil
Top achievements
Rank 1
 answered on 24 Nov 2015
2 answers
128 views

I have a custom template for editing a scheduler event. In that template I have a grid to edit an array that is part of my model:

 @(Html.Kendo().Grid<Excent.Apps.Web.Solo.Models.MeetingStudentViewModel>(Model.Students)
                .Name("StudentsGrid")
                .Columns(columns =>
                {
                    columns.Bound(m => m.MeetingStudentID).Hidden();
                    columns.Bound(m => m.FullName).Title("Student");
                    columns.Bound(m => m.Goals);
                })
                .BindTo(Model.Students)
                .DataSource(dataSource => dataSource
                     .Ajax().ServerOperation(false)
                    .Model(model => model.Id(p => p.MeetingStudentID))
                     .Model(model => model.Field(o => o.FullName))
                     .Model(model => model.Field(o => o.Goals))
               )

When I display the template the grid is empty.

Zoran
Top achievements
Rank 1
 answered on 24 Nov 2015
4 answers
72 views

When I popup a recurrence event, it does not go back to the server where I have logic that is based on the start date before current date.

How do I manipulate the Model that it creates from a recurrence event so that I can hide things based on the start date in my custom template?

in my model I have isPassed but this is based on the first in the series and not the current event.. 

 

 

 

Zoran
Top achievements
Rank 1
 answered on 24 Nov 2015
4 answers
160 views

When my page containing a grid control in MVC 5 with Bootstrap is shrunk to below 1024 px. in width, the grid paging control gets distorted as shown in the attached screenshots.

I'm using a scaffolded MVC UI (2015.3.930) grid inside a default _layout body, i.e. it is being inserted inside a div with classes "container body-content" that have not been modified.

I am using customized bootstrap themes that I generated using the Bootstrap theme builder and the Kendo UI theme builder. To the best of my knowledge, I have only altered colors in the custom themes, not anything related to padding or sizing.

Anyone else seen this problems or have suggestions how to proceed or work around this behavior?

Iliana Dyankova
Telerik team
 answered on 24 Nov 2015
7 answers
195 views

Hi,

my treeview configuration at view:

@Html.Raw((Html.Kendo().TreeView().Name("AppellationTree").LoadOnDemand(true)
                .Events(events => events
                    .Select("TreeView_onSelect"))
                    .Template("# return escapeHtml(item.Name); #")
                .DataSource(d => d
                    .Model(m => m
                        .Id("Id")
                        .HasChildren("HasChildren")
                        .Children("Children")
                        .Field("IsAppellation", typeof(bool)))
                    .Read(r => r.Action("_AppellationTree", "Appellation", new { id = Model.Id })))
                .DataTextField("Name")))

My _AppellationTree method:

[ActionName("_AppellationTree")]
        public JsonResult GetAppellationData(int id)
        {
            var model = new List<TreeItemModel>();
            var appellations = _appellationRepo.GetList(x => x.ParentAppellation.Id == id).OrderBy(x => x.Name);
            foreach (var appellation in appellations)
            {
                var r = new TreeItemModel();
                r.Id = appellation.Id;
                r.Name = appellation.Name;
                r.HasChildren = appellation.HasChildren;
                model.Add(r);
            }

            return Json(model, JsonRequestBehavior.AllowGet);
        }

I'd like to add Expand Action with javascript function and launch loading data during expanding node. How to do it? I think that should possible out of the box with three js lines like:

function onExpand(e)

{

     get data (next level) from server

     attache data to existing data source

     fire expanding

}

Best regards

Bart

Boyan Dimitrov
Telerik team
 answered on 24 Nov 2015
9 answers
469 views

Hello 

Within my editor for a scheduler I'm changing some values through an AJAX-call and apparantely this does not change the model since the update action is never fired when I press update. The update works fine if I change a model bound value. How can I manually set the model as dirty?

Do I do it in the success method for the AJAX call and how?

Basically I just need to trigger update wheter the model is changed or not.

/Jonas

Vladimir Iliev
Telerik team
 answered on 24 Nov 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?