Telerik Forums
UI for ASP.NET MVC Forum
0 answers
117 views
Is there a way to allow templates to use an "image/jpg" (byte) type in a model to populate an <img>
I have fooled around with a couple of ways with no real way forward.

Many Thanks

Liam
Top achievements
Rank 1
 asked on 02 Oct 2012
0 answers
153 views
Hello,

we are using DatePickers / TimePickers in a batch editable grid. Our problem is: if i edit such a cell on the iPad it immediately opens the keyboard. If i use a DatePicker standalone it just opens the keyboard if I click on the TextBox of the control. If I just click on the calendar-symbol it opens only the calendar - no keyboard.

What I'd like to have is the same behaviour as a standalone DatePicker. When I click in the cell of my grid it just should open the calendar and only if I click on the TextBox of my DatePicker-control it should show the ipad-keyboard.

Hope you understand what I mean. I know this is a very special case but if you have any solution for this I would be very happy. Hopefully you can help me :)

Best regards,
Mathias
Mathias
Top achievements
Rank 1
 asked on 02 Oct 2012
10 answers
412 views
The following code does not create list at all:
@(Html.Kendo()
.ListView<ReportTypeViewModel>()
.Name("listView")
.TagName("ul")
.DataSource(ds => ds.Read(read => read.Url("/api/ReportApi/List").Type(HttpVerbs.Get)))
.ClientTemplateId("templateReportList"))

When I pass list to the constructor by:
.ListView<ReportTypeViewModel>(types)
this is working.

Url "/api/ReportApi/List" is MVC 4 web api.

However when I checked not MVC version of list the following code works:
function initList() {
        $("#listview").kendoMobileListView({
                template: "<a><span>${data.Name}</span></a>",
                dataSource: new kendo.data.DataSource({
                    transport: {
                        read: "/api/ReportApi/List",
                        type: "json"
                    },
                }),
                style: "inset"
            });
    }
Above is mobile list view. But web also is working without problem. The only issue I have is MVC wrapper.

UPDATE:
I've posted this in wrong thread - could you please move it to proper one?
Marcin
Top achievements
Rank 1
Veteran
 answered on 02 Oct 2012
1 answer
217 views
Hi ,
I've developed a few lines of code with ASP.NET MVC wrappers of Telerik
A Customer Entity with ID , Name , Rate
Entity Framework Code First Context
A Controller with this code : 

public ActionResult Index()
        {
            return View();
        }
 
        public ActionResult Customers([DataSourceRequest] DataSourceRequest request)
        {
            var customers = Context.Customers.ToDataSourceResult(request);
            return Json(customers);
        }

and a view with this code

@(Html.Kendo().Grid<Customer>()
    .Name("CustomersGrid")
    .Columns(columns =>
    {
        columns.Bound(c => c.ID).Groupable(false);
        columns.Bound(c => c.FName);
        columns.Bound(c => c.LName);
        columns.Bound(c => c.Rate);
    })
        .Groupable()
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("Customers", "Customer"))
    )
)

when render of view finishes at the end of @HTML.Kendo
I give this exception

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


Line 19:         .Scrollable()
Line 20:         .Filterable()
Line 21:         .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("Customers", "Customer"))
Line 22:     )
Line 23: )

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +72
   System.Collections.ObjectModel.Collection`1.set_Item(Int32 index, T value) +10419142
   System.Web.Mvc.ControllerContext.get_RequestContext() +25
   Kendo.Mvc.UI.NavigatableExtensions.GenerateUrl(INavigatable navigatable, ViewContext viewContext, IUrlGenerator urlGenerator) +52
   Kendo.Mvc.UI.Fluent.CrudOperationBuilder.SetUrl() +81
   Kendo.Mvc.UI.Fluent.CrudOperationBuilder.Action(String actionName, String controllerName, Object routeValues) +66
   Kendo.Mvc.UI.Fluent.CrudOperationBuilder.Action(String actionName, String controllerName) +47
   ASP._Page_Views_Customer_Index_cshtml.<Execute>b__1(CrudOperationBuilder read) in c:\Users\a.rezaei\Desktop\MVCWebApp\MVCWebApp\Views\Customer\Index.cshtml:21
   Kendo.Mvc.UI.Fluent.AjaxDataSourceBuilderBase`2.Read(Action`1 configurator) +131
   ASP._Page_Views_Customer_Index_cshtml.<Execute>b__0(DataSourceBuilder`1 dataSource) in c:\Users\a.rezaei\Desktop\MVCWebApp\MVCWebApp\Views\Customer\Index.cshtml:21
   Kendo.Mvc.UI.Fluent.GridBuilder`1.DataSource(Action`1 configurator) +212
   ASP._Page_Views_Customer_Index_cshtml.Execute() in c:\Users\a.rezaei\Desktop\MVCWebApp\MVCWebApp\Views\Customer\Index.cshtml:7


Extra Info

Windows : 8 , Visual Studio Development Server , Visual Studio 2012 , .NET 4.5 , MVC 4 , Kendo UI MVC Wrappers v2012.2.710
 
thanks for your support
Yasser Moradi
Top achievements
Rank 1
 answered on 02 Oct 2012
1 answer
179 views
Hello,

I have an entity with regular properties as well as navigation properties.

The grid fails to load anything If any item in the whole DataSourceResult has any of navigation properties populated (if any entity has has any other entity associated with it).

I do not want to use any of the data from the navigation properties in the grid, I want to only use the regular properties.

Controller:
public ActionResult GetPeopleData([DataSourceRequest] DataSourceRequest request)             
{
    return Json(db.People.ToDataSourceResult(request));
}
View:
@(Html.Kendo().Grid<Models.Person>()
    .Name("PeopleGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Id).Groupable(false).Visible(true);
        columns.Bound(p => p.LastName);
        columns.Bound(p => p.FirstName);
    })
    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetPeopleData", "People"))
        )
    .Events(events => events.Change("PeopleGrid_RowSelected"))
)

If I clear all the associated tables and just have the people table populated the grid works fine.

Anyone have any ideas?
Vladimir Iliev
Telerik team
 answered on 01 Oct 2012
1 answer
253 views
Delete me please, I figured it out.
Praseeda
Top achievements
Rank 1
 answered on 01 Oct 2012
0 answers
288 views
I have an Upload control that works fine, except I want to show the user if their file was accepted or not. I've followed the Documentation example to show the alert message, but I don't want an alert popup - I want to display the message next to the file in the same way that the Cancel/Uploading buttons appear in the example, and the check mark appears. However, I'm extremely new to jQuery and don't understand how to go about that. It also doesn't make sense to me that no matter what I send, it is regarded as a success...
View:
@model Datamart.Models.FileSpec
 
@{
    ViewBag.Title = "Upload Datamart File";
}
 
<h2>Upload Excel File</h2>
 
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
File must be less than 16MB and must be an Excel spreadsheet<br />
@(Html.Kendo().Upload()
.Name("files")
.ShowFileList(true)
.Multiple(true)
.Messages(msg => msg
    .StatusUploaded("Response Status Goes Here?")
    .StatusFailed("statusFAiled")
    .StatusUploading("Uploading")
.Async(a => a
    .AutoUpload(true)
    .Save("Save","FileUpload")
    )
    .Events(e => e
        .Success("onSuccess")
        )
     
)
 
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript">
function onSuccess(e) {
    alert("Status: " + e.response.status);
}
</script>

Controller:
public ActionResult Save(IEnumerable<HttpPostedFileBase> files)
{
    foreach (var file in files)
    {
        string UPLOADSDIRECTORY = Server.MapPath("~/App_Data/uploads");
        // Verify that the user selected a file
        if (file != null && file.ContentLength > 0)
        {
            // extract only the filename
            var fileName = Path.GetFileName(file.FileName);
            /* check the first three letters of the extension for xls - there are far too many endings for Excel to check all of them */
            if (Path.GetExtension(file.FileName).Substring(1, 3) == "xls")
            {
                // store the file inside ~/App_Data/uploads folder
                var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
                FileInfo fInfo = new FileInfo(path);
                if (!(fInfo.Exists))
                {
                    file.SaveAs(path);
                    var dataFile = new FileSpec { FileName = fileName };
                    db.FileSpec.Add(dataFile);
                    db.SaveChanges();
                    // if successful, then redirect to the Edit page so the user can fill in the tab name while it's still fresh in their mind
                    return Json(new { status = "OK" }, "text/plain");
                }
                // TODO: redirect to error message because the file already exists
                return Json(new { status = "Overwritten" }, "text/plain");
            }
            // TODO: redirect to error message because the file was not an Excel file (as determined by extension)
            return Json(new { status = "Rejected" }, "text/plain");
        }
    }
    // default to Default status
    return Json(new { status = "Default" }, "text/plain");
 
}
Samuel
Top achievements
Rank 2
 asked on 28 Sep 2012
0 answers
154 views
my jquery is only working for the 1st editor, but is not recognized after this 1st editor is closed. Ideas? Thank you
MelF
Top achievements
Rank 1
 asked on 28 Sep 2012
4 answers
142 views
I don't see the dirction property on the MVC wrapped menu, do we lose functionality by using the MVC wrappers? If not, how do I specify the direction the menu will open?

Thanks!
Kamen Bundev
Telerik team
 answered on 28 Sep 2012
2 answers
202 views
Hello,

I think I found a new bug. We deactivated the delete confirmation with the DisplayDeleteConfirmation-property. Works perfectly for the delete-button in the grid. Only problem: When I delete a row manually the confirmation is still shown.

Here my code:
function myFunction()
{
var gridChoosenValues = $('#MyGrid').data("kendoGrid");
var choosenItems = gridChoosenValues.items();
for (var i = 0; i < choosenItems.length; i++) //delete every row
{
grid.removeRow(choosenItems[i]); //this triggers delete confirmation :(
}
}


hope this will be fixed soon. And a method for deleting all rows of a grid would also be very nice :)

Best regards,
Mathias
Mathias
Top achievements
Rank 1
 answered on 28 Sep 2012
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
ColorPicker
DateRangePicker
Security
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?