Telerik Forums
UI for ASP.NET MVC Forum
4 answers
303 views
Hi All,

I need to create an image column in my detail view. But the data field #= BroadcastEvent # is not recognized in client template at this line.
columns.Bound(o => o.BroadcastEvent).Title("").ClientTemplate( "<img src='" + Url.Content("~/Images/") + "#= BroadcastEvent #.png' />" );
#=DataField is always taking the Master Grid Data source. How can we access Data field of Detail view in client template on Detail view?

Code for Master grid

​ @(Html.Kendo().Grid<iPort.Models.CalanderItems>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.Time);
columns.Bound(e => e.CalanderStartTime).Hidden();
})
.Sortable()
.Pageable()
.ClientDetailTemplateId("template")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("GetCalanderData", "ClientViewActLogGrid"))
)
.Events(events => events.DataBound("dataBound"))
)

The data source for master grid is iPort.Models.CalanderItems

public class CalanderItems
{
public long ID {get; set;}
public DateTime CalanderStartTime { get; set; }
public string Time { get; set; }
public DateTime CalanderEndTime { get; set; }        
    }

 


Code for Detail Grid


<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<iPort.Models.CalanderActivity>()
.Name("grid_#=ID#")
.Columns(columns =>
{
 columns.Bound(o => o.BroadcastEvent).Title("").ClientTemplate( "<img src='" + Url.Content("~/Images/") + "#= BroadcastEvent #.png' />" );
columns.Bound(o => o.OccurranceTime);
columns.Bound(o => o.Title);
columns.Bound(o => o.Place);
columns.Bound(o => o.Description);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetCalanderActivities", "ClientViewActLogGrid", new { StartTime = "#=ID#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>

The datasource for detail grid is
iPort.Models.CalanderActivity

public class CalanderActivity
{
public long ID {get; set;}
public string Title {get; set;}
public DateTime OccurranceDate {get; set;}
public string OccurranceTime { get; set; }
public string Description { get; set; }
public string Place { get; set; }
public string BroadcastEvent { get; set; }
}

Rachel
Top achievements
Rank 1
 answered on 29 Aug 2014
1 answer
105 views
Hello,

Can you please tell me what CSS properties will allow me to set the
'Reports' Menu Header text to White and the Header background to Black
(default background color) when a dropdown option 'Purchase History' is
selected.

Please see attached image.

Thank You in Advance!

Robert
Kiril Nikolov
Telerik team
 answered on 29 Aug 2014
3 answers
123 views
I have a very simple demo of the Gantt in MVC and scroll isn't working correctly. Only the data scrolls, not the header. Attached are photos.

Here is my source code (very basic):

<div class="row">
@(Html.Kendo().Gantt<Gantt.Models.TaskViewModel, Gantt.Models.DependencyViewModel>()
    .Name("gantt")
    .Columns(columns =>
    {
        //columns.Bound(c => c.TaskID).Title("ID").Width(50);
        columns.Bound("title").Editable(false).Sortable(true);
        columns.Bound("start").Title("Start Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(false).Sortable(true);
        columns.Bound("end").Title("End Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(false).Sortable(true);
    })
    .Views(views =>
    {
        views.DayView();
        views.WeekView(weekView => weekView.Selected(true));
        views.MonthView();
    })
    .Height(800)
    .ShowWorkHours(false)
    .ShowWorkDays(false)
    .Snap(true)
    .Editable(false)
    .Selectable(true)
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.TaskID);
            m.ParentId(f => f.ParentID);
            m.OrderId(f => f.OrderId);
            m.Field(f => f.Expanded).DefaultValue(true);
        })
        .Read("ReadTasks", "Home")
        //.Create("CreateTask", "Gantt")
        //.Destroy("DestroyTask", "Gantt")
        //.Update("UpdateTask", "Gantt")
    )
    .DependenciesDataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.DependencyID);
            m.PredecessorId(f => f.PredecessorID);
            m.SuccessorId(f => f.SuccessorID);
            m.Type(f => f.Type);
        })
        .Read("ReadDependencies", "Home")
        //.Create("CreateDependency", "Gantt")
        //.Destroy("DestroyDependency", "Gantt")
        //.Update("UpdateDependency", "Gantt")
    )
)</div>
Kiril Nikolov
Telerik team
 answered on 29 Aug 2014
1 answer
225 views
Hello,

Does anyone have a working sample or know of complete documentation that shows how to create a dynamic menu that is built upon hierarchy settings that are retrieved from SQL Server, utilizing C# and MVC?

Thank You in Advance!

Robert
Dimo
Telerik team
 answered on 29 Aug 2014
4 answers
101 views
How do I get the drop down box wider.  See attached image.
Georgi Krustev
Telerik team
 answered on 28 Aug 2014
3 answers
347 views
Hi Guys,

I was trying to list of values from Action, but the action always get null value.

my cshtml
<div class="form-group">
    @Html.LabelFor(m => m.OrganizationName, new { @class = "col-md-4 control-label" })
    <div class="col-md-4">
        @Html.Kendo().AutoCompleteFor(m => m.OrganizationName)
.MinLength(3).Name("OrganizationName")
.DataSource(s => { s.Read(r => { r.Action("FindVets", "General"); }); })
.DataTextField("Name")
.HtmlAttributes(new { @class = "form-control" })
    </div>
</div>


Action :
public JsonResult FindVets(string OrganizationName)
{
    var Vets = General.GetRegularVet();
    var a = (from v in Vets
             where v.Name.ToUpper().Contains(OrganizationName.ToUpper())
             select v).ToList();
    return Json(a, JsonRequestBehavior.AllowGet);
}



Daniel
Telerik team
 answered on 28 Aug 2014
1 answer
89 views
I need to have a dropdown list appear in each row of a grid that is "fed" from the DataSource of the parent grid.  I have a property in the grid datasource that is an object array.

Below is the grid datasource.  I have a KendoGrid with a template on the "programVersion" column that creates the drop down.  I'm failing adding the data to it.  I've created (stolen and modified) an example (http://jsbin.com/cacabi/1/) that does almost what I want (I've been googling for a couple of hours).  I've included my JSON Array in the datasource to show what I'm using. 
http://jsbin.com/cacabi/1/edit

I basically want the Category dropdown to be populated with the programVersion data (which is different for each row).

Any direction or guidance will be greatly appreciated.  Thanks in advance

{
    "entityKey": "268900",
    "number": "QR000024",
    "companyDescription": "Mountain West",
    "programDescription": "Intangible",
    "programVersions": [
        {
            "versionId": 201226,
            "versionDescription": "2013WorkingCapitalBudget",
            "isCurrent": 0
        },
        {
            "versionId": 201227,
            "versionDescription": "Anotherbudgetversion",
            "isCurrent": 0
        },
        {
            "versionId": 201208,
            "versionDescription": "WorkingBudget",
            "isCurrent": 1
        }
    ],
    "$c": 1981,
    "$r": 1,
    "$checked": false,
    "$checkedEnabled": true
}
Louis
Top achievements
Rank 1
 answered on 28 Aug 2014
1 answer
570 views
I would like to have some top level folders in the file and image browser inside the editor to be read-only not allowing a user to rename, delete, and add items to the root folder. I want a user to be able to navigate to some predefined folders under the root folder and to be able to modify the contents under them.  This isn't my structure but an example would be to have folders <website>/UserXFiles/HiRes & <website>/UserXFiles/thumbnail and only allow a user to be able to modify the contents in the HiRes and thumbnail folders but nothing above (still need the user to navigate to the different folders).  Is there functionality built into the browsers to achieve this?

Also is there a way to initialize the browsers to a directory:  If my structure was like the one above how would I start the user inside the Files folder?

Thank you,
Abram
Dimo
Telerik team
 answered on 28 Aug 2014
1 answer
122 views
Hi,

In the foreign key example the foreign key data used for the dropdown is obtained from the ViewData.

However, with a Web API binding ViewData is not accessible from the web api controller.

What is the best practice approach in this situation?

Thanks
Alexander Popov
Telerik team
 answered on 28 Aug 2014
3 answers
255 views
I have a simple controller which sends colored and Name. I want to bind  to a kendoUI combobox.   I am putting my sample code with this.

Controller

namespace KendoMVCStudy.Controllers
{
public class GetColorController : Controller
{
//
// GET: /GetColor/

public ActionResult Index()
{
Color _color = new Color();
List<Color> _colors = new List<Color>();

_color.Colorid = 1;
_color.Name = "White";

_colors.Add(_color);

_color.Colorid = 2;
_color.Name = "Black";

_colors.Add(_color);

return Json(_colors, JsonRequestBehavior.AllowGet);

//return View(_colors);
}




}
}

Model



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace KendoMVCStudy.Models
{
public class Color
{
public int Colorid { get; set; }
public string Name { get; set; }
}
}

View

@model List<KendoMVCStudy.Models.Color>

@{
ViewBag.Title = "Index";
}

<h2>Index</h2>


<div class="demo-section">
<h2>Products</h2>

@(Html.Kendo().ComboBox()
.Name("products")
.DataTextField("Name")
.DataValueField("Colorid")
.HtmlAttributes(new { style = "width:250px" })
.Filter("contains")
.AutoBind(true)
.MinLength(3)
.DataSource(source => {
source.Read(read =>
{
read.Action("Index", "GetColor");
})
.ServerFiltering(true);
})
)
</div>







Daniel
Telerik team
 answered on 28 Aug 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
Window
ListView
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
Licensing
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
AICodingAssistant
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
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?