Telerik Forums
UI for ASP.NET MVC Forum
5 answers
337 views
Hello,

I have line charts with multiple data (even more than 10.000 points). I see that Kendo UI supports pan and zoom option. Though I found only example code for Html http://demos.kendoui.com/dataviz/bar-charts/pan-and-zoom.html. Is there some kind of example code for MVC ?


Best regards.


Iliana Dyankova
Telerik team
 answered on 30 Sep 2014
2 answers
247 views
I have the Required attribute on my model, but when I use DatePickerFor, Kendo Validator does not pick that up.  If I use the F12 tools and manually add "required='required'" to the input that the DatePicker renders, then Validator picks it up and shows a message next to the picker.  Besides that, it's also not picking up the ErrorMessage on my Required attribute.  I'm assuming I could add another attribute to the <input> for it to pick that up as well, but not yet sure what the attribute name is.  Can you please explain why I can't just get this behavior out of the box, and if this is a bug with the DatePickerFor?  I'd rather not have to use .HtmlAttributes to manually stick these things onto every DatePicker.  Maybe I'm just missing something, but for something like this, you expect it to just work.  Thanks!
Michael
Top achievements
Rank 1
 answered on 29 Sep 2014
4 answers
5.6K+ views
Hi there,

in my case, I have a ViewModel on the client side. It works and shows the data from the "real" model. The real model consists of an object that contains other objects, e.g. ArchivedDoubleValue refers to a Station, which has a name, via its StationId. In my ViewModel, things are flattened in order to be fast and avoid circular dependencies, so there is:

int Id (ArchivedDoubleValue.Id)
double Value (ArchivedDoubleValue.Value)
string StationName (refers to Station.Name and gets set in the controller)

Now, when I want to sort or filter the StationName column, I run into an error, because StationName does not exist in the "real" model, only StationId.

So I thought I could simply "translate" the Member String in DataSourceRequest.Groups and DataSourceRequest.Sorts back into the corresponding Id. That worked quite well:

When grouping in the client, the request.Groups contains an entry with its Member set to "StationName". This is just a string and I change it to the corresponding StationId. Same works well for sorting.

But it DOES NOT work for filtering!  When debugging and peeking into he request at runtime, I can see and change the Filters Members and Values, but when I try to change it via code in the controller, I can not access it:

            if (request.Filters.Count > 0)
            {
                foreach (var f in request.Filters)
                {
                    String fs = f.Member.ToString();

This gives me an error:
Kendo.Mvc.IFilterDescriptor does not contain a definition for "Member"

How am I supposed to filter the "real" data with the filter set to a column in my ViewModel? I wonder how to do that? Or is there a way to access request.Filters? I think that would be the most elegant way to do it as it wiould be transparent to the client.

Please help me with that, thanks in advance!

Regards, Rob
Rosen
Telerik team
 answered on 29 Sep 2014
1 answer
147 views
My Kendo Comboxbox server binding is not working

This is my View
 @(Html.Kendo().ComboBox()
              .Name("cbxState")
              .HtmlAttributes(new { style = "width:150px" })
              .Text("Select State")
     
              .DataTextField("Code")
              .DataValueField("Code")
               .Filter(FilterType.Contains)
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("cbx_read", "Home");
                  })
                  .ServerFiltering(true);
              })
              )


This is my Controller       

public ActionResult cbx_read([DataSourceRequest]DataSourceRequest request)
         {
             using (var northwind = new Connection())
             {
                 IQueryable<LostDayDetail> Customers = northwind.LostDayDetail;
                 DataSourceResult result = Customers.ToDataSourceResult(request, Customer => new CustomerDetail
                 {
                     Code = Customer.Code,
                     Name = Customer.Name,
                     Days = Customer.Days
                 });
                 return Json(result);
             }
        }

When I click on Combobox, it calls cbx_read function and it gets all 12 rows of data from database table. but when contol comes back to view, the combobox is blank.
Please help me




Georgi Krustev
Telerik team
 answered on 29 Sep 2014
1 answer
382 views
I'm sure this is actually really simple and I'm just making it really complicated, but I could really use a fresh set of eyes on this one.

When a user loads my page with the grid on it, I get the url referrer via JavaScript and analyze it via regex. If the url has a TransactionID (int) in it, I assign it to a JavaScript variable.

Here's my problem: I want to find the row in the grid with that TransactionID and have the grid go right to it (like if it's farther down the grid, I want the grid to scroll down to that row automatically). One way I think I can do this is to focus the row itself, but I can't figure out how to get to it in JavaScript. If I could find the row with the TransactionID, then just call the focus() function, I think that will solve this thing.

Here's what I have. Please help! :(

​
@(Html.Kendo().Grid(Model)
.Name("TransactionGrid")
.DataSource(dataSource => dataSource
    .Server()
    .Model(model => model.Id(o => o.TransactionsTrackingID))
    .PageSize(1000)
)
.Columns(columns =>
{
    columns.Template(
        @<text>
<a href='@Url.Content("~/Transaction/Details/" + @item.TransactionID)' style="cursor:pointer;">
    Details</a>
</text>
    ).Width(53);
    columns.Bound(r => r.TransactionID).Title("ID").Hidden();
    columns.Bound(r => r.MessageType).Filterable(ftb => ftb.Cell(cell => cell.Delay(autoCompleteDelay)));
     
})
.HtmlAttributes(new { style = "width:100%;" })
.Resizable(resizing => resizing.Columns(true))
.Pageable()
.Groupable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.Sortable(sorting => sorting.Enabled(true))
.Scrollable(s => s.Height(600))
                        )




<script type="text/javascript">
 
 
    $(document).ready(function () {
 
        var referrer = '';
 
        if (document.referrer) {
            referrer = document.referrer;
        }
 
        var re1 = '(Transaction)'; // Alphanum 1
        var re2 = '(\\/)'; // Any Single Character 1
        var re3 = '(Details)'; // Word 1
        var re4 = '(\\/)'; // Any Single Character 2
        var re5 = '(\\d+)'; // Integer Number 1
 
        var p = new RegExp(re1 + re2 + re3 + re4 + re5, ["i"]);
        var m = p.exec(referrer);
 
        if (m !== null) {
            var transactionId = m[5]; //this gets the transactionID
 
            var grid = $("#TransactionGrid")
            grid.ready(function () {
                //The code I will need goes in here. :(
            });
        }
    });
</script>
Nikolay Rusev
Telerik team
 answered on 29 Sep 2014
7 answers
1.4K+ views
I need to make a cascading combobox with server filtering but I'm having trouble setting the initial value.The dropdownlist on which the combobox depends looks like this:

1.@(Html.Kendo().DropDownListFor(model => model.SelectedCompany)
2.    .Name("UserDetailSelectedCompany")
3.    .HtmlAttributes(new { style = "width:115px;" })
4.    .BindTo(Model.CompanyList)
5.    .Value(Model.SelectedCompany))
Where:
  • model.SelectedCompany is a string
  • Name attribute is set because I need that in the combobox (I've read on the Kendo UI forums I'm not supposed to specify it, but I don't know how to do the cascading combobox without it)
  • Model.CompanyList is a List<string>
And here's the combobox:

01.@(Html.Kendo().ComboBoxFor(model => model.SelectedDealer)
02.    .Name("UserDetailSelectedDealer")
03.    .DataTextField("Name")
04.    .DataValueField("ID")
05.    .HtmlAttributes(new { style = "width:325px" })
06.    .Filter(FilterType.Contains)
07.    .AutoBind(false)
08.    .Enable(false)
09.    .MinLength(3)
10.    .DataSource(source => source.Read(read => read.Action("GetDealers", "Administration").Data("Administration.GetUserDealerParameters"))
11.                                .ServerFiltering(true))
12.    .CascadeFrom("UserDetailSelectedCompany")
13.    .SelectedIndex(Model.SelectedDealer.ID))
Where:
  • model.SelectedDealer is a Dealer
  • Dealer class contains a Name(string) and an ID (int)
  • MVC action GetDealers return a JSON converted List<Dealer>
Does anyone have an example that demonstrate how I can get this to work? The Kendo UI doc has example for a cascading combobox, server filtering and setting initial value, but not for the 3 at same time.
Daniel
Telerik team
 answered on 29 Sep 2014
1 answer
398 views
Hello,

I am using a Kendo Grid popup which displays a Kendo editor to modify the content of the field. The field is configured on the MVC server side with the annotation to validate length to be 500 characters as follows:

[AllowHtml]
[StringLength(500, ErrorMessageResourceName = "ActionMaxLength", ErrorMessageResourceType = typeof(Resources.Messages))]
public string Action { get; set; }

If the user enters more than 500 characters in the Kendo editor this validation works. However, our users reported that when they added more formatting (tables, bullet lists) the validation pops up even if the visible character count is not 500. I understand from a technical perspective the character count being validated includes the behind-the-scenes html formatting tags, however this is not intuitive to the end user.

My question is, is there any alternative or built in approach to validate just the html-stripped character count of the Kendo editor validation?

Regards,
V. Joseph


Alex Gyoshev
Telerik team
 answered on 29 Sep 2014
5 answers
658 views
I am currently trying to add custom markers to a map in MVC C#.
Is there anyway of creating a different shape/image in MapMarkersShape to display it on the map?
My current code is as follows:

@(Html.Kendo().Map()
    .Name("map")
    .Center(30.268107, -97.744821)
    .Zoom(3)
    .Layers(layers =>
    {
        layers.Add()
            .Type(MapLayerType.Bing)
            .Shape(MapMarkersShape.Pin) // -< this line
            .Key("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); 
    })
)

Thanks
Daniel
Top achievements
Rank 1
 answered on 29 Sep 2014
3 answers
143 views
I have a View with multiple dropdowns(15-20). Currently I implemented server binding for all of these by creating ViewData for every dropdown before loading the View. Is this the best way for implementing multiple dropdowns(server binding)?
Note: Don't want to use AJAX binding.
Georgi Krustev
Telerik team
 answered on 26 Sep 2014
1 answer
78 views
Hi,
 
I have used Kendo UI in an MVC web application. Of late I have been experiencing slowness in IE8 browser.
While the same code loads the screen in less than 2 secs in Chrome/IE10, it takes more than 5-6 seconds to load in IE8 browser.
Kendo widgets used in the screen includes Dropdowns, Treeview and Kendo Tabstrip.
I have tried replacing the kendo dropdowns with normal ones. This gave me a slight improvement of about 1 sec.
The kendo dropdown is a part of my cshtml page and not initialized by the jquery. Is this the best way to implement kendo widgets?
Is there any other way which will provide me with a better performance?

Dimo
Telerik team
 answered on 26 Sep 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?