Telerik Forums
UI for ASP.NET MVC Forum
2 answers
529 views
I have a grid in which I am using the client detail template and I need a little help with the syntax.  I am trying to do a fairly simple conditional against an item in the parent grid data.  When I start typing the syntax as I think it should be, I get "Preprocessor directives must appear as the first non-whitespace character on a line".  Here is what I am typing:
Minutes Early/Late: @if(#: PODInfo.MinutesEarlyLate #  > 0){  #: PODInfo.MinutesEarlyLate # Late  } else { On Time }
I am fairly new to Razor, and maybe here I need Javascript instead.  I have actually tried both, but it is the # syntax with which I think I am having trouble.

Thank you in advance for any help!

Donna

In case - here's the grid
@(Html.Kendo().Grid<GMCRepository.Models.DataServices.ShipmentInformation>().Name("ShipmentList")
.DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("ShipmentInfoList", "DataInquiry"))
)
.Columns(columns =>
{
    columns.Bound(shipment => shipment.TrackingNumber);
    columns.Bound(shipment => shipment.ShipDate);
    columns.Bound(shipment => shipment.ShipperInformation.Address.City);
    columns.Bound(shipment => shipment.ShipperInformation.Address.StateProvince);
    columns.Bound(shipment => shipment.RecipientInformation.Address.City);
    columns.Bound(shipment => shipment.RecipientInformation.Address.StateProvince);
    columns.Bound(shipment => shipment.AmountDue);
    columns.Bound(shipment => shipment.BillingInfo.BillToAccount);
    columns.Bound(shipment => shipment.CustomerReference);
})
.ClientDetailTemplateId("shipmentDetail-template")
)
Here's the client detail template:
<script id="shipmentDetail-template" type="text/x-kendo-template">
    <div class="shipment-grid-detail">
        <div class="row-fluid">
            <div class="span4 shipment-div">
                <h4>Shipper Information</h4>
                #: ShipperInformation.Name # <br />
                #: ShipperInformation.Company # <br />
                #: ShipperInformation.Address.AddressLine1 # <br />
                #: ShipperInformation.Address.AddressLine2 # <br />
                #: ShipperInformation.Address.City #, #: ShipperInformation.Address.State #  #: ShipperInformation.Address.PostalCode #, #: ShipperInformation.CountryCode #
            </div>
            <div class="span4 shipment-div">
                <h4>Recipient Information</h4>
                #: RecipientInformation.Name # <br />
                #: RecipientInformation.Company # <br />
                #: RecipientInformation.Address.AddressLine1 # <br />
                #: RecipientInformation.Address.AddressLine2 # <br />
                #: RecipientInformation.Address.City #, #: RecipientInformation.Address.State #  #: RecipientInformation.Address.PostalCode #, #: RecipientInformation.CountryCode #
            </div>
            <div class="span4 shipment-div">
                <h4>Shipment Information</h4>
                Ship Date: #: ShipDate # <br />
                Service: #: PackageInfo.Service # <br />
                Packaging: #: PackageInfo.PackageDescription # <br />
                Actual Weight: #: PackageInfo.ActualWeight.Weight # #: PackageInfo.ActualWeight.WeightUnit # <br />
                Billed Weight: #: PackageInfo.BilledWeight.Weight # #: PackageInfo.BilledWeight.WeightUnit # <br />
                Dimensions: #: PackageInfo.dimensions.DimLength # x #: PackageInfo.dimensions.DimWidth # x #: PackageInfo.dimensions.DimHeight # #: PackageInfo.dimensions.DimUOM # <br />
                Pieces: #: PackageInfo.Pieces #
            </div>
        </div>
        <div class="row-fluid">
            <div class="span4 shipment-div">
                <h4>Delivery Information</h4>
                POD Date: #: PODInfo.PODDate # <br />
                POD Name: #: PODInfo.PODSignature # <br />
                Minutes Early/Late: @if(#: PODInfo.MinutesEarlyLate #  > 0){  #: PODInfo.MinutesEarlyLate # Late  } else { On Time }
            </div>
            <div class="span4 shipment-div">
                <h4>Billing Information</h4>
                Payment Option: #: BillingInfo.PaymentOption # <br />
                Zone: #: BillingInfo.CarrierZone # <br />
                Bill To Account: #: BillingInfo.BillToAccount # <br />
                Payment File Ref: #: BillingInfo.PaymentReference # <br />
                Closing Run: #: BillingInfo.PaymentRefFileName # <br />
                Bundle Number: #: BillingInfo.BundleNumber #
            </div>
            <div class="span4 shipment-div">
                <h4>Charge Information</h4>
                <div class="row-fluid">
                    <div class="span6">
                        Original Amount: <br />
                        Credits: <br />
                        Refunds: <br />
                        Amount Due:
                    </div>
                    <div class="span6">
                        #: OriginalAmount # <br />
                        #: Credits # <br />
                        #: Refunds # <br />
                        #: AmountDue #
                    </div>
                </div>
                <div class="row-fluid">
                    @(Html.Kendo().Grid<GMCRepository.Models.DataServices.ChargesInformation>().Name("ShipmentCharges")
                    .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("ChargesList", "DataInquiry"))
                    )
                    .Columns(columns =>
                    {
                        columns.Bound(charge => charge.ChargeDescription);
                        columns.Bound(charge => charge.ChargeAmount);
                    })
                    .ToClientTemplate())
                </div>
            </div>          
        </div>
        <div class="row-fluid">
            <div class="span4 shipment-div">
                <h4>Cost Center Information</h4>
                Cost Center: #: BillingInfo.CostCenter # <br />
                Match Type: #: BillingInfo.CostCenterMatchType # <br />
            </div>
            <div class="span4 shipment-div">
                <h4>References</h4>
            </div>
        </div>
    </div>
</script>

Donna Stewart
Top achievements
Rank 1
 answered on 24 Jun 2013
5 answers
316 views
Trying to update to the 2013.1.319 version of Kendo.Mvc.dll but it gives a warning.  It says that the most common cause is that there's a conflict of the local and GAC versions.  I don't have it in the GAC.

Just need a way to get the most recent dll file.  Which, according to this post below, is the way to toggle the readonly property of a Kendo dropdown.

http://www.kendoui.com/forums/mvc/dropdownlist/dropdownlist-readonly()-not-recognized.aspx
Filip
Telerik team
 answered on 24 Jun 2013
7 answers
520 views
If I open the demo at http://demos.kendoui.com/web/tabstrip/index.html and hit Tab to navigate using the keybard, I can see a blue margin highlighting that the TabStrip has focus. 

If I open the theme editor with the default theme, there is no indication that the TabStrip has focus. How can I get my TabStrib to provide feedback to the user that it has focus as the demo page does?

Thank you
Ande2013
Top achievements
Rank 1
 answered on 24 Jun 2013
2 answers
487 views
Hi!

I'm new to MVC4 and thus built some little demo including a Kendo UI Grid and a partial view which serves as a custom editor. Everything works perfect except that the AntiForgeryToken gets lost on the way.

This is my definition of the grid:
@(Html.Kendo().Grid(Model)
    .Name("grdProducts")
    .Columns(columns =>
        {
            columns.Bound(p => p.Name);
            columns.Bound(p => p.ProductType);
            columns.Bound(p => p.SellStartDate);
            columns.Bound(p => p.SellEndDate);
            columns.Command(command => command.Edit()).Width(160);
        })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable
        .Mode(GridEditMode.PopUp)
        .DisplayDeleteConfirmation(true)
        .TemplateName("ProductEditor")
        .Window(w => w
            .Width(700)
            .Title("Edit Product")))
    .Pageable(pa => pa.Numeric(false).PageSizes(new [] {5,10,20}))
    .Scrollable(scr => scr.Height(430).Virtual(false))
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    .DataSource(dataSource => dataSource
        .Ajax()
        .AutoSync(false)
        .Batch(false)
        .PageSize(20)
        .ServerOperation(false)
        .Model(model =>
            {
                model.Id(p => p.Id);
                model.Field(p => p.Id).Editable(false);
                model.Field(p => p.CategoryName).Editable(false);
                model.Field(p => p.ProductType).DefaultValue((int)ProductTypeEnum.Cameras);
            })
        .Create(create => create.Action("EditingCreate", "Product"))
        .Read(read => read.Action("EditingRead", "Product"))
        .Update(update => update.Action("EditingUpdate", "Product"))
    )
)
And this is the start of my partial view named "ProductEditor.cshtml" saved in subdir "EditorTemplates":
@model _ProductStore.Infrastructure.Models.Products.Product

@{
    ViewBag.Title = "Edit";
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
 
    <fieldset>
... all labels and fields...
    </fieldset>
}
The popup opens as it should and everything works fine except that the hidden input for AntiForgeryToken looks like this:
<input name="__RequestVerificationToken" type="hidden" data-bind="value:__RequestVerificationToken" value=""/>
In other words: the value is empty. Placing the AntiForgeryToken helper somewhere else in my views it is working perfectly.

What am I doing wrong?

Regards
Neils






Heiko
Top achievements
Rank 1
Iron
Veteran
 answered on 24 Jun 2013
1 answer
201 views
Hi,
In below url you have two example HTML and Asp.net MVC.

http://demos.kendoui.com/web/autocomplete/index.html


Can you tell me what is difference between this two.(HTML and Asp.net MVC)


Thank you
Amitkumar

Atanas Korchev
Telerik team
 answered on 24 Jun 2013
3 answers
2.3K+ views
hi,

I test kendoui MVC razor, follow this way my test project

_Layout.cshtml

   <script src="@Url.Content("~/Scripts/kendo/jquery.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/kendo.web.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/kendo.aspnetmvc.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/console.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/prettify.min.js")"></script>

index.cshtml 

@(Html.Kendo().DatePicker().Name("Birthday"))

But have error on javascript 

TypeError: jQuery(...).kendoDatePicker is not a function

Ilyas
Top achievements
Rank 1
 answered on 21 Jun 2013
1 answer
659 views
I have a Grid-component that is populated by a call to a service, from an action in my controller. I was wondering if it is possible to do this continuously, so that it will update the grid with real-time data? 

Right now, my view looks like this;
@model FleetMonitorModel
 
<div class="span12">
    <legend>Fleet Monitor</legend>
        <div>
        @(Html.Kendo().Grid<FleetMonitorModel>()
              .Name("Grid")
              .DataSource(ds => ds
                  .Ajax()
                  .Read(read => read.Action("Get", "FleetMonitor"))
              )
              .HtmlAttributes(new { style = "height:auto;" })
              .AutoBind(true)
              .Columns(columns =>
                  {
                      columns.Template(p => { }).ClientTemplate(" ").Width(310);
                      columns.Template(p => { }).ClientTemplate(" ").Width(250);
                      columns.Template(p => { }).ClientTemplate(" ").Width(150);
                      columns.Template(p => { }).ClientTemplate(" ");
                      columns.Template(p => { }).ClientTemplate(" ").Width(80);
                  })
              .ClientRowTemplate(Html.Partial("_ClientRowTemplate", Model).ToHtmlString())
              .Pageable()
              .Sortable())
    </div>
</div>
And my controller like this:
    private FleetMonitorModel Model { get; set; }
 
    ...      
 
    public ActionResult Get([DataSourceRequest] DataSourceRequest request)
    {
        UnitContract[] listOfUnitsFromService = Client.GetListOfUnits(true);
 
        Model = new FleetMonitorModel()
                    {
                        UnitDetails = GenerateUnitDetails(listOfUnitsFromService.ToList()),
                        Refresh = true
                    };
 
        return Json(Model.UnitDetails.ToDataSourceResult(request));
    }
}

Basically, the service will provide a steady stream of updated data, causing it to be more or less real-time.. All I want to accomplish, is to refresh the grid with my new data and update the graphical elements of my template. Current template is working fine, but data is only refreshed when page is refreshed.
Vladimir Iliev
Telerik team
 answered on 21 Jun 2013
6 answers
245 views
Hi,

I currently have a model with several properties, one of which is a Spatial object (of type DbGeometry). If this spatial property is NULL, everything works fine, but if it's not, my ListView throws an exception (ironically enough, it thinks the problem is that the list is null). My list creation code is below:

@(Html.Kendo().ListView(Model.ToList())
    .Name("s-list-event-container")
    .TagName("div")
    .HtmlAttributes(new { @class = "s-list-container" })
    .ClientTemplateId("template-list-event")
)
where "Model" refers to an IEnumerable object.

If there is no way to populate the ListView while the model has a DbGeometry object, is there at least a way to ignore specific properties of a model?

Thanks,
Jeff
Petur Subev
Telerik team
 answered on 21 Jun 2013
3 answers
810 views
Is it possible to filter an MVC Listview based on text entered into a textbox? if so how would one go about doing so?

for example a listview that returns over 400 records, and needs to be searchable.

Stephen Graham
Top achievements
Rank 1
 answered on 20 Jun 2013
1 answer
92 views
This screen shot says it all:
https://dl.dropboxusercontent.com/u/17474320/Validator-Miss-positioned.png

The code has:

            @(Html.Kendo().DropDownList()
                  .Name("OwnerUserId")
                  .HtmlAttributes(new { style = "width:200px", @required = true })
                  .OptionLabel("(Select User)")
                  .DataTextField("Name")
                  .DataValueField("Id")
                  .DataSource(source => {
                       source.Read(read => {
                           read.Action("GetCascadeUser", "ComboBox")
                              .Data("filterUsers");
                       }).ServerFiltering(true);
                  })
                  .Enable(true)
                  .AutoBind(true)
            )

How do I fix that, so the validation is positioned correctly?
Petur Subev
Telerik team
 answered on 20 Jun 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
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
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
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?