Telerik Forums
UI for ASP.NET MVC Forum
10 answers
815 views
I have a drop down in a grid.  Some of my data contains the pound character '#'.

When I have an even number of occurrences of the '#' in my drop down choice data, there is no issue.  I assume this is because the characters cancel out.

However, when I have an odd number of choices, I get an Invalid Template error.  I assume that this is most likely me screwing something up, but I am also aware that the '#' character is used to help mark the beginning and end of kendo template logic.

Also, along with this issue, even if I avoid the meltdown of the template, I do get a a weird rendering of drop down values that have a '#' character when I exit that cell's edit mode.  I believe the garbled replacement for the pound sign is part of the generated template code (See attached image for this).

Grid code - Not that my drop down list is a ForeignKey column (Not sure if that's relevant, but I thought I'd point it out):
@(Html.Kendo().Grid(Model.EnterpriseModel.EnterpriseReferenceBook)
    .Name("EnterpriseReferenceTypeDictionaryGrid")
    .Columns(columns =>
    {
        columns.Bound(item => item.Value);
        columns.ForeignKey(i => i.RefReferenceTypeID,
            (System.Collections.IEnumerable)ViewBag.RefReferenceTypeFamilyListing, "RefReferenceTypeID", "Type");
        columns.Command(command =>
        {
            command.Destroy();
        }).Width(100);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Top))
    .Navigatable(navigatable => navigatable.Enabled(true))
    .Pageable(pageAction =>
    {
        pageAction.PageSizes(new int[] { 25, 50 });
    })
    .Sortable()
    .Scrollable()
    .Filterable()
    .Resizable(resize => resize.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .ServerOperation(false)
        .Events(events =>
        {
            events.Error("EnterpriseReferenceTypeDictionaryGrid_ErrorHandler");
        })
        .Model(model =>
        {
            model.Id(i => i.EnterpriseReferenceTypeID);
        })
        .Read(read => read.Action("GetEnterpriseReferences", "ReferenceGrid"))
        .Create(create => create.Action("CreateEnterpriseReferences", "ReferenceGrid"))
        .Update(update => update.Action("UpdateEnterpriseReferences", "ReferenceGrid"))
        .Destroy(delete => delete.Action("DeleteEnterpriseReferences", "ReferenceGrid"))
    )
)

Please let me know if there is anything else I can provide.
Kiril Nikolov
Telerik team
 answered on 02 Oct 2013
3 answers
197 views
May have found a bug, or at least it was unexpected behavior for me.

@(Html.Kendo().TabStrip()
    .Name("tabStrip")
    .Items(tabs =>
             {
                  tabs.Add().Text("Tab1").Content(@<text>some content</text>).Selected(true);
                  tabs.Add().Text("Tab2").LoadContentFrom("Action", "Controller");
             })
)


If I am on "Tab2" and click "Tab1" but quickly click back to "Tab2" before the animation is complete it loads my partial view (from the controller action) outside of the tabstrip and overwrites the page content. I was able to reproduce with the default animation set up.

Kamen Bundev
Telerik team
 answered on 01 Oct 2013
4 answers
453 views
Hi,

I have a Master Detail Grid in Kendo UI

I want to add rows to Detail Grid with a Foriegn Key Column that is driven by Master Id, how do i accomplish this ?

I have highlighted the Foreign Key Column in bold

@(Html.Kendo().Grid<PackageModel>()
            .Name("RGrid")
            .Columns(col =>
            {
                col.Bound(c => c.Name).Visible(true);
                col.Bound(c => c.PackageName).Visible(true).Title("Package");                               
            })
            .DataSource(ds => ds
                .Ajax()
                .Events(e => e.RequestStart("onDataRequestStart"))
                .Model(m =>
                {
                    m.Id(c => c.OId);
                })
                .Read(read => read.Action("ReadPackages", "RGrid", new { area = "Recommendation", gridSettings = "##settings##" }))                
            )                        
            .ClientDetailTemplateId("recostemplate")
            .Navigatable()
            .Pageable(p => p.PageSizes(true))
            .Filterable()
            .Sortable()
            .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
        )



<script id="recostemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<SE.OrderBook.Web.Models.View.RecommendationModel>()
                .Name("RecosGrid#=Id#")
                .Columns(columns =>
                {
                    columns.Bound(o => o.Id).Title("Id").Visible(true);
                    columns.ForeignKey(o => o.DeliverableId, commonService.GetDeliverableDropList(), "Id", "Value");
                    columns.Bound(o => o.DeliverableName).Title("Deliverable").Visible(true);
                    columns.Bound(o => o.Included).Visible(true);
                    columns.Bound(o => o.ServiceStart).Format("{0:d}").Title("Service<br />Start");
                    columns.Bound(o => o.ServiceEnd).Format("{0:d}").Title("Service<br />End");                    
                    columns.Bound(o => o.Year1).Visible(true);
                    columns.Bound(o => o.Total).Visible(true);
                    columns.Bound(o => o.PackageId).Hidden(true);
                    columns.Command(cmd => { cmd.Edit().UpdateText("Save"); /*cmd.Destroy();*/ }).Visible(true).Width("10%");                    
                })
                .DataSource(ds => ds
                    .Ajax()
                    .PageSize(5)
                    .Model(m =>
                    {
                        m.Id(c => c.Id);
                        m.Field(c => c.PackageId).DefaultValue("#=Id#");
                    })
                    .Read(read => read.Action("Read", "Home", new { area = "Recommendation", id = "#=Id#" }))
                    .Create(update => update.Action("Create", "Recos", new { area = "Recommendation" }))
                    .Update(update => update.Action("Update", "Recos", new { area = "Recommendation" }))
                    .Destroy(delete => delete.Action("Delete", "Recos", new { area = "Recommendation" }))
                )
                .ToolBar(toolbar => { toolbar.Create(); })
                .Events(events =>
                {
                    events.Edit("onRecoDetailsEdit");
                    events.Save("onRecoDetailsSave");
                })
                .Editable(e => e.Mode(GridEditMode.PopUp))
                .Pageable()
                .Sortable()
                .ToClientTemplate())
</script>


I need to pass package Id into commonService.GetDeliverableDropList() but i am not sure how to accomplish this?

I think solution to this is only possible at run time through AJAX, if particular than is there an example how i can populate foriegn key colum dropdown list through AJAX ?

Waiting for Response,

Kind Regards,




Taha
Top achievements
Rank 1
 answered on 01 Oct 2013
2 answers
380 views
This is a weird problem.  The issue occurs only occasionally.  There is an image file in the "~/Content/textures/" directory called "highlight.png" (a Kendo UI file).  Occasionally when I try to create a new "Event" in the Scheduler I will get a 500 error.  Here is the message:

"NetworkError: 500 Internal Server Error - http://mywebsite.azurewebsites.net/error/Error?aspxerrorpath=/Sessions/textures/highlight.png"

You can see it is looking for the file in "~/Sessions/textures/".  This is wrong!  The "Sessions" component is the controller where this is being execute but the file is actually in "~/Content/textures/".  Yes, I have the folder and file included in the VS 2012 project.  Another time I got a "404 Not Found" for the same file with the bad path when I looked inside the NET tab of Firebug in the "GET highlight.png" trace.  This also succeeds with the right path sometimes.

Does this make any sense to anyone?  How could this get the wrong path half the time?
Entilzha
Top achievements
Rank 2
 answered on 01 Oct 2013
3 answers
551 views
Please tell me the way to bind the tree view using data source.
I am using the below code to bind the tree view,I am not  sure I am on the right track.


@(Html.Kendo().TreeView()
    .Name("treeview").DataTextField("Name")
    .DataSource(dataSource => dataSource
        .Read(read => read
            .Action("GetFolderTreeData", "Dashboard")
        )
    ) 
    
    
)
Atanas Korchev
Telerik team
 answered on 30 Sep 2013
1 answer
79 views
Hello,

I am calling a Window that populates using a Controller Action Partial View.   My window will contain cascading dropdowns.  If I add a serverfiltering with a datafilter to my datasource I get a javascript error saying it can't find said method.   When I remove the filter the box populates but Autocomplete doesn't work properly.    If I change it to clientside filtering it works fine but I need to be able to add a group filter.     Is Server filtering not available inside a Window control ?

I prepared a sample project to illustrate the problem. 

Thanks,
Carrie
Petur Subev
Telerik team
 answered on 30 Sep 2013
1 answer
85 views
Hi all,

Since last week, the online demo for all Kendo UI pages are not able to display in IE, Chrome and firefox, sample page:

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

the console shows there has many JS syntax errors, I want to show those sample to my colleagues but seems all pages are not working, is there anyone also has the same problem?

Michael
Atanas Korchev
Telerik team
 answered on 30 Sep 2013
3 answers
202 views
I have implemented Kendo MVC Upload to our ASP.NET MVC 4.0 web app. Unfortunately we get many  dropped uploads. 

The upload method is executed but it contain empty file list and Request.ContentLengh and Request.TotalBytes do not match. Do you have any idea why this happens?

 [HttpPost]
public ActionResult UploadFile(IEnumerable<HttpPostedFileBase> clientUpload, [OptionModelBinder]IOptionViewModel formData)
{
//our action
}

T. Tsonev
Telerik team
 answered on 27 Sep 2013
3 answers
142 views
Hi,
I am trying add tabs into an existing tabstrip and it works as expected. But when the number of tabs increase it goes to the second line. Is there a feature that will place the tabs on the same line.
Thanks in advance
Dimo
Telerik team
 answered on 26 Sep 2013
1 answer
1.2K+ views
I would like to be able to map a DataSourceResult to a ViewModel in my controller class, is this possible?

I have a pretty normal MVC application with a ViewModel
public class UserViewModel
   {
       public UserViewModel()
       {
           WebSiteUsers = new List<WebSiteUser>();
       }
       public List<WebSiteUser> WebSiteUsers { get; set; }
   }
 
   public class WebSiteUser
   {
       public int UserId { get; set; }
       public string Username { get; set; }
       public string FirstName { get; set; }
       public string LastName { get; set; }
   }

And a normal Grid in razor
@(Html.Kendo().Grid<Views.Users.ViewModel.WebSiteUser>()
    .Name("Grid")
    .Columns(columns =>
        {
            columns.Bound(p => p.UserId);
            columns.Bound(p => p.Username);
            columns.Bound(p => p.FirstName);
            columns.Bound(p => p.LastName);
        })
         
        .Pageable(p => p.PageSizes(true))
     .HtmlAttributes(new { style = "height:500px;" })
     .DataSource(dataSource => dataSource
         .Ajax()
         .PageSize(20)
         .Model(model => model.Id(p => p.UserId))
         .Read(read => read.Action("Users_Read", "Users"))
     )
 
)
My controller has the following action for AJAX binding for filtering.

public ActionResult Users_Read([DataSourceRequest]DataSourceRequest request)
       {
           DataSourceResult result = _user.GetSiteUsersKendo(request);
 
           return Json(result);
       }

My service class has the method for getting the users.
public DataSourceResult GetSiteUsersKendo([DataSourceRequest]DataSourceRequest request)
       {
           using (TestEntities context = new Models.TestEntities())
           {
               IQueryable<Models.WebSiteUser> webSiteUsers = context.WebSiteUsers;
 
               DataSourceResult result = webSiteUsers.ToDataSourceResult(request);
 
               return result;
           }
       }

This code returns a Javascripts serialisaztion error - Object connection closed. I presume this is because the JSON call in the controller is trying to serialise the entity framework object perhaps trying to perform some kind of lazy loading but of course the connection to the DB is closed as it's in a 'Using' statement.

What I'm trying to achieve is a way to return a ViewModel to the grid from the controller action. 

I can force the DataSourceResult to map to a POCO using the following code in my service class. I do NOT want to use a ViewModel in my service class, only the controllers should be aware of the ViewModels.
DataSourceResult result = webSiteUsers.ToDataSourceResult(request, su => new Models.UserModels.WebSiteUser{
                    UserId = su.UserId,
                    Username = su.Username
                });
But then I still need to map the DataSourceResult to a ViewModel in the controller.

Is this possible?






Petur Subev
Telerik team
 answered on 26 Sep 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
DropDownButton
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
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?