Telerik Forums
Kendo UI for jQuery Forum
1 answer
221 views

<script type="text/javascript">
 
  
 
  
 
    $(document).ready(function () {
 
  
 
        var validator = $("#tickets").kendoValidator({
 
            rules: {
 
                upload: function (input) {
 
                    if (input[0].type == "file") {
 
                        return input.closest(".k-upload").find(".k-file").length;
 
                    }
 
                    return true;
 
                }
 
            }
 
        }).data("kendoValidator");
 
  
 
  
 
        $("button").click(function (e) {
 
  
 
            if (!validator.validate()) {
 
                e.preventDefault();
 
            }
 
        });
 
    });
 
  
 
   
 
  
 
    $("#fuActivitySheet").kendoUpload({
 
        multiple: false
 
    });
 
  
 
</script>






<div id="tickets">
    @using (Html.BeginForm("UploadNewActivitySheet", "Vendor", FormMethod.Post, new { id = "UploadActivitySheet", enctype = "multipart/form-data", @class = "clearfix padding_t25" }))
{
     
            @Html.TextBoxFor(model => model.UploadedFile, new { id = "fuActivitySheet", name="fuActivitySheet" , type = "file" })
 
               @Html.ValidationMessageFor(m => m.UploadedFile)
        
       <button class="k-button" type="submit">Submit</button>
    
    
}
 
</section>
</div>





[Display(Name = "Activity Sheet: ")]
[Required(ErrorMessage = "Please Select Activity sheet to upload")]
public System.Web.HttpPostedFileBase UploadedFile { get; set; }

Thanks,
J

Jayesh Goyani
Top achievements
Rank 2
 answered on 20 Oct 2012
1 answer
514 views
Hello,

JS
$(document).ready(function () {
 
       var validator = $("#tickets").kendoValidator({
           rules: {
               upload: function (input) {
                   if (input[0].type == "file") {
                       return input.closest(".k-upload").find(".k-file").length;
                   }
                   return true;
               }
           }
       }).data("kendoValidator");
 
 
       $("button").click(function (e) {
 
           if (!validator.validate()) {
               e.preventDefault();
           }
       });
   });
$("#fuActivitySheet").kendoUpload({
       multiple: false
   });


Cshtml
<div id="tickets">
@using (Html.BeginForm("UploadNewSheet", "Vendor", FormMethod.Post, new { id = "UploadSheet", enctype = "multipart/form-data" }))
{
        @Html.TextBoxFor(model => model.UploadedFile, new { id = "fuActivitySheet", name="fuActivitySheet" , type = "file" })
 
<br />
 
<button class="k-button" type="submit">Submit</button>
}
</div>

Model
[Display(Name = "Sheet: ")]
      [Required(ErrorMessage = "Please Select sheet to upload")]
      public System.Web.HttpPostedFileBase UploadedFile { get; set; }




Thanks,
Jeet bhatt
Jayesh Goyani
Top achievements
Rank 2
 answered on 20 Oct 2012
6 answers
1.0K+ views
I have following code (default from mvc application)
@using (this.Html.BeginForm(new { this.ViewBag.ReturnUrl }))
{
    @Html.AntiForgeryToken()
 
       <div class="l-editor-label">
        @this.Html.LabelFor(m => m.UserName)
    </div>
    <div class="l-editor-field">
        @this.Html.TextBoxFor(m => m.UserName, new { @class = "k-textbox" })
        @this.Html.ValidationMessageFor(m => m.UserName)
    </div>
 
    <div class="l-editor-label">
        @this.Html.LabelFor(m => m.Password)
    </div>
    <div class="l-editor-field">
        @this.Html.PasswordFor(m => m.Password, new { @class = "k-textbox" })
        @this.Html.ValidationMessageFor(m => m.Password)
    </div>
 
    <div class="l-editor-label">
        @this.Html.CheckBoxFor(m => m.RememberMe, new { @class = "k-checkbox" })
        @this.Html.LabelFor(m => m.RememberMe)
    </div>
 
    <p class="button">
        <button class="k-button"> Log in</button>
    </p>
 
    <p>@this.Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")</p>  
}
 
<script src="@this.Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"> </script>
<script src="@this.Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"> </script>     
<script src="@this.Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"> </script>

I tried to replace jquery validation by replacing scripts according with suggestion from other post:

$("form").kendoValidator();

But this is not working. Could anybody tell me what is the quickest way to do that?
Marcin
Top achievements
Rank 1
Veteran
 answered on 20 Oct 2012
0 answers
105 views
Hello. How solve this problem? kendoWindow default draggable "true" when maximize kendoWindow must be not draggable and when it's minimizet it must be draggable again. Thanks for help)
mizza
Top achievements
Rank 1
 asked on 19 Oct 2012
2 answers
246 views
Issue when including the expanded value in model for datasource the treeview icon changes to plus but does not expand. The selected property works as expected when included in model.

Model:
[{"Name":"Test1","Id":15,"hasChildren":true,"expanded":true,"items":[{"Id":8,"Name":"level2a","hasChildren":false,"selected":false},
{"Id":10,"Name":"level2b","hasChildren":false,"selected":false}],
{"Name":"Test2","Id":14,"hasChildren":true,"expanded":true,"items":[{"Id":9,"Name":"level3a","hasChildren":false,"selected":false}],
{"Name":"Test3","Id":11,"hasChildren":true,"expanded":true,"items":[{"Id":7,"Name":"level3a","hasChildren":false,"selected":false}}]}]
Martin
Top achievements
Rank 1
 answered on 19 Oct 2012
3 answers
331 views
Using asp.net MVC 3, is it possible to bind a collection of interfaces to a Kendo Grid instead of a concrete class? For example:

Controller
IEnumerable<IFoo> items = repo.GetFoo();
return View( items );

View
@model IEnumerable<IFoo>
 
@Html.Kendo().Grid(Model).Name("Grid").Columns(column =>
{
    column.Bound(c => c.Name).Title("Foo Name");
    column.Bound(c => c.Key).Title("Foo Key");
}).DataSource(dataSource => dataSource.Ajax().ServerOperation(false))


When binding directly to IEnumerable<IFoo>, the following exception is raised:
Exception Details: System.MissingMethodException: Cannot create an instance of an interface.
 
Source Error:
Line 7:  @Html.Kendo().Grid(Model).Name("Grid").Columns(column =>

Using the Kendo Grid, are we constrained to using concrete types for everything? Or is there a way to use an interfaces?

Thanks!
nCubed
Top achievements
Rank 1
 answered on 19 Oct 2012
2 answers
292 views
Hi,

I'm having trouble trying to make a Scroller component work. Basically, what i want to do is a scrollable table with fixed headers at the top and left (fixed in the sense that they are always visible, but they follow the table content as it scrolls). The problem is that when i initialize the Scroller using kendoMobileScroller the table only scrolls horizontally; the vertical scrolling doesn't work. Here's a simplified example showing this behaviour (it doesn't have the fixed headers on the table.. it's just a scrollable table).

I guess i'm doing something wrong here, as it's a very simple example, but i haven't figured it out.

Thanks in advance :)

Edit: i've found a previous thread that discusses a similar problem, but it was from an older version of Kendo (i'm using 2012.2.913).
John Willey
Top achievements
Rank 1
 answered on 19 Oct 2012
0 answers
110 views
I'm wondering how to set the grid editable property from false to true from a button to toggle the grid from readonly to r/w mode. Thanks
Chris
Top achievements
Rank 1
 asked on 19 Oct 2012
0 answers
226 views
Hello,
I am using the Kendo UI ComboBox with an external, XML DataSource. Here's the DataSource code:

    try
        {
            var csDataSrc = new kendo.data.DataSource(
            {
                transport:
            {
                read: "Data/StateList.xml",
                dataType: "xml",
                create: { cache: true }
            },
            schema:
            {
                type: "xml",
                data: "/States/State",
                model:
                {
                    fields:
                    {
                        id: "id/text()",
                        name: "name/text()"
                    }
                }
            }
        });
        csDataSrc.read();
    }
    catch (err)
    {
        log.error(err.message);
    }


That creates the data source, here's the code that creates the kendo combobox:


    $("#stateList").kendoComboBox(
    {
   index: 0,
   placeholder: "Begin typing Coverage State...",
   dataTextField: "name",
   dataValueField: "id",
   filter: "contains",
   dataSource: csDataSrc,
   text: $("#hdnStateName").val(),
   value: $("#hdnStateKey").val(),
   change: function(e)
   {
   $("#hdnStateKey").val(this.value());
   $("#hdnStateName").val(this.text());
   }
    });


This works really well but the data for the real list is enormous and I'd like to store it in local storage with something like this:
    localStorage.setItem("state_key", csDataSrc);
Then when the page loads instead of building and reading from the server side xml all the time, I'd like for it to be something like this:


    var csDataSrc = localStorage.getItem("state_key");
    if(csDataSrc === null)
    {
        // create the data source with the above code
        // and store it in localStorage.
    }
Then bind it here...


    ...kendoComboBox(
    {
        ...,
        .dataSource: csDataSrc,
        ...
    });


I create the data source fine, it seems to store correctly in localStorage but when you leave the page and come back the data source is always null.  I can see it using the resources tab of the Chrome developer tools but it won't bind to the combo box correctly.
Any help or if I need to elaborate on anything to make this clearer please let me know


Thanks
-s

Sean
Top achievements
Rank 1
 asked on 19 Oct 2012
0 answers
158 views
I have a grid that has one column with checkbox.It uses batch editing to save the changes. I need to make cells editable/uneditable  in the row when checkbox in that row is checked/unchecked.

Thanks,
Sanjeev
Sanjeev
Top achievements
Rank 1
 asked on 19 Oct 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
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?