Telerik Forums
UI for ASP.NET MVC Forum
2 answers
208 views
Hello,

I have an MVC application that uses the Grid control.  I have configured .NET DataAnnotations, which includes error messages, and it is working.  When there is a data entry validation error, Javascript displays my error message(s).  The issue that I have is that each message that is displayed does not tell me the name of the field that has invalid data.  The following is the Javascript function that Kendo uses in its examples.  I can't find details as how to add the field name to the message that is displayed.  I hope that someone can help me.

Thanks,

Mike

function error(e) {
    if (e.errors) {
        var message = "Errors:\n";
        $.each(e.errors, function (key, value) {
            if ('errors' in value) {
                $.each(value.errors, function () {                   
                    message += this + "\n";
                });
            }
        });

        alert(message);
    }
}
</script>



Mike
Top achievements
Rank 1
 answered on 05 Sep 2012
0 answers
198 views
I am looking for a easy way to load the sitemap xml from a string vs loading it from a sitemap.xml file.  I came up with this but it is a hack at best.  Basically i already have the xml for the sitemap and wanted to just load it directly not via the filesystem.  Any Ideas?

// To Load the SiteMap into telerik framework
SiteMapManager.SiteMaps.Register<AnotherXmlSiteMap>("sample", siteMap => siteMap.LoadFrom("~/sample.sitemap"));
 
// Binding in UI
@Html.Kendo().Menu().Name("Menu").BindTo("sample")
 
// classes to support it
public class AnotherXmlSiteMap : XmlSiteMap
{
  public AnotherXmlSiteMap() : base(new PathResolver(), new AnotherVPP(), DI.Current.Resolve<ICacheProvider>())
  {
         
  }
 
  public override void LoadFrom(string relativeVirtualPath)
  {
      base.LoadFrom(relativeVirtualPath);
  }
}
 
public class AnotherVPP : IVirtualPathProvider
{
  public bool DirectoryExists(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public bool FileExists(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public string GetDirectory(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public string GetFile(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public string GetExtension(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public string CombinePaths(string basePath, string relativePath)
  {
      throw new NotImplementedException();
  }
 
  //public string ReadAllText(string virtualPath)
  public string ReadAllText(string sessionKey)
  {
      return @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<siteMap>
<siteMapNode title=""Home"" controller=""Home"" action=""Overview"">
<siteMapNode title=""Grid"">
<siteMapNode controller=""grid"" action=""index"" title=""First Look (Razor)"" area=""razor""/>
<siteMapNode controller=""grid"" action=""index"" title=""First Look (ASPX)"" area=""aspx""/>
<siteMapNode controller=""grid"" action=""editing"" title=""Batch editing (Razor)"" area=""razor""/>
<siteMapNode controller=""grid"" action=""editing"" title=""Batch editing (ASPX)"" area=""aspx""/>
<siteMapNode controller=""grid"" action=""from-table"" title=""Initialization from table (Razor)"" area=""razor""/>
<siteMapNode controller=""grid"" action=""from-table"" title=""Initialization from table (ASPX)"" area=""aspx""/>
</siteMapNode>
<siteMapNode title=""Menu"">
<siteMapNode controller=""menu"" action=""index"" title=""First Look (Razor)"" area=""razor""/>
<siteMapNode controller=""menu"" action=""index"" title=""First Look (ASPX)"" area=""aspx""/>
<siteMapNode controller=""menu"" action=""events"" title=""Events (Razor)"" area=""razor""/>
<siteMapNode controller=""menu"" action=""events"" title=""Events (ASPX)"" area=""aspx""/>
<siteMapNode controller=""menu"" action=""api"" title=""API (Razor)"" area=""razor""/>
<siteMapNode controller=""menu"" action=""api"" title=""API (ASPX)"" area=""aspx""/>
<siteMapNode controller=""menu"" action=""images"" title=""Images (Razor)"" area=""razor""/>
<siteMapNode controller=""menu"" action=""images"" title=""Images (ASPX)"" area=""aspx""/>
</siteMapNode>
</siteMapNode>
</siteMap>";
  }
 
  public string ToAbsolute(string virtualPath)
  {
      throw new NotImplementedException();
  }
 
  public string AppendTrailingSlash(string virtualPath)
  {
      throw new NotImplementedException();
  }
}
Doug
Top achievements
Rank 1
 asked on 05 Sep 2012
0 answers
270 views
Ok so a real simple DropdownFor MVC 4 Razor VS 2012.

   <div class="editor-field">
        <h3>Married</h3>
        @(Html.Kendo().DropDownListFor(model => model.MaritalStatus)
          .Name("MaritalStatus")
          .BindTo(new List<string>() {
              "Married",
              "Single",
              "Divorced",
              "Separated",
              "Committed Partnership"
          }))
    </div>

Only the word Married is displayed because it seems the inline style is defaulting to display, inline:none

See attached for the screen shots.

Any thoughts?

Pat NH USA

Anybody else notice working with JavaScript is a lot like Fortran 4 with punch cards only not as easy to debug?

Pat Tormey
Top achievements
Rank 1
 asked on 05 Sep 2012
0 answers
65 views
When using Ascending / Descending along with the Sort method I get a compile error. For example, this works fine:

    @code
        
        Html.Kendo.Chart(Model).Name("DayChart").Title("CourtPay Daily Totals").
        DataSource(Function(d) d.Read("DayTotals", "CourtPay").
        Group(Function(x) x.Add(Function(m) m.ApplicationCode)).
        Sort(Function(s) s.Add(Function(md) md.PaymentDate))).
        Series(Function(d) d.Bar("Amount")).
        CategoryAxis(Function(a) a.Categories(Function(m) m.PaymentDate)).
        HtmlAttributes(New With {.style = "height:900px; width:700px;"}).
        Theme("Black").
        Render()
    
    End Code

However, this throws an "Expression Does Not Produce a Value" error:

    @code
        
        Html.Kendo.Chart(Model).Name("DayChart").Title("CourtPay Daily Totals").
        DataSource(Function(d) d.Read("DayTotals", "CourtPay").
        Group(Function(x) x.Add(Function(m) m.ApplicationCode)).
        Sort(Function(s) s.Add(Function(md) md.PaymentDate).Descending)).
        Series(Function(d) d.Bar("Amount")).
        CategoryAxis(Function(a) a.Categories(Function(m) m.PaymentDate)).
        HtmlAttributes(New With {.style = "height:900px; width:700px;"}).
        Theme("Black").
        Render()
    
    End Code
steve
Top achievements
Rank 1
 asked on 04 Sep 2012
0 answers
92 views
Hi,

I understand that disabling an html control results in no value being posted back the server, but I would think the DropDownList control would be able to automatically be able to compensate for this instead of having to manage this on my own with hidden controls.   Is this perhaps a future enhancement? 

David A.
David A.
Top achievements
Rank 1
 asked on 04 Sep 2012
0 answers
195 views
My first attempt with the telerik MVC Razor grid, and all seems to be going well. However, I have one item that may be just a simple issue to resolve... I have a grid with 40 rows, and if I have scrolled into the records and then hit the Add New Record button, the grid does open the new record row at either the top or bottom, depending how I configured it. However, the grid does not automatically scroll to the new row for input. Is there a setting or another means to have the grid automatically show the New Record row when Add New Record is clicked?

Thx.

Michael
Michael
Top achievements
Rank 1
 asked on 04 Sep 2012
2 answers
945 views
I'm trying to implement a custom command on a grid that needs to invoke an MVC method that accepts the currently selected rows in the grid as an argument (probably as an IEnumerable<>).  The method would in turn create a view based on the selections.

I have no problem defining the toolbar button, or even setting .Action() to the MVC method I want to call. I just don't know how to tell Action to send the data I need.

I've also tried implement the onclick method on that button.  While i can ultimately invoke onclick, once there nothing i've tried results in the outcome i want.

I'm using the grid in Ajax mode.

Any suggestions?
David
Top achievements
Rank 1
 answered on 04 Sep 2012
1 answer
198 views
Hello!

Following situation:
- Splitter
- A div insinde of a panel of the splitter
- Makeing this div draggable using jQueryUI

Problem: That doesn't work anymore. As soon as I remove the splitter, everything works fine. Is this a bug?
Dimo
Telerik team
 answered on 04 Sep 2012
1 answer
92 views
Hi Friend,

When I click on "Add New Item" in grid, It display pop screen.  But I am not get any design and control type in it.

Example: In case of Date Column, I am not getting Date Calender control on popup.  I got simple textbox without design.

I have added screenshot of it.

Let me know if you not understand my query.

Please help me to solve it.

Regards,
Iliana Dyankova
Telerik team
 answered on 04 Sep 2012
2 answers
218 views
Hi,

I try to create a DateTimePickerFor to pick my StartDate in an MVC Application.

@(Html.Kendo().DateTimePickerFor(model => model.StartTime)
.Format(
"dd.MM.yyyy HH:mm")
.Name(
"DateTimePickerStartTime")
.Value(DateTime.Now)
)

When I load the page I can just see a textbox. The DropDownListFor worked fine.

In IE developer tools it says:
Object does not support the property or method "kendo datetimepicker"

But I did not even create the object, it is created by the WidgetFactory.

Can you tell me what I missed?
Ra
Top achievements
Rank 1
 answered on 03 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
MultiColumnComboBox
Dialog
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?