Telerik Forums
Kendo UI for jQuery Forum
0 answers
46 views

I am using Kendo UI MVC wrappers for my project . Here is a sample POST data during an update call:

Category.Text   Excluded
Category.Value  0
Category[Text]  Excluded
Category[Value] 0
HiddenDevice    false
ID  8
IconType    3
Info.IPAddress  10.200.93.125
Info.Model  xxx
Info.SerialNumber   xxx
Info[IPAddress] 10.200.93.125
Info[Model] xxx
Info[SerialNumber]  xxx
Name    xxx
Status.Type Connected
Status[Type]    Connected
Trigger.ID  1
Trigger.Name    xxx
Trigger[ID] 1
Trigger[Name]   xxx
filter
group 
sort

I've used client-side ajax binding. All non-flattened model variables have two sets of data in post call.

Also earlier when using telerik MVC model decorated with read-only data annotations wont be posted during update call, but not any more.
While migrating from telerik MVC to kendo UI MVC, am facing some issues with non-flattened variables. 

Do I have to handle all these cases manually in client js events or am i doing something wrong?
Fredy
Top achievements
Rank 1
 asked on 19 Aug 2012
0 answers
124 views
hi

I have a piece of my web service code here and i wondering if this webservice is good enough to be used with json? How should i call it with json? Thanks a lot

<WebMethod(Description:="Sales")> _
   Public Function Sales(ByVal Region as String) as SalesClass()

     Dim ds As New DataTable
     ds = getSales(Region)

     Dim newSales as SalesClass() = new SalesClass(ds.Rows.Count - 1) {}

     Dim i As Integer
     For i = 0 To ds.Rows.Count - 1
     newSales(i) = New SalesClass()

     If Not DBNull.Value.Equals(ds.rows(i)(0)) then
     newSales(i).Region = ds.rows(i)(0)
     End If

     If Not DBNull.Value.Equals(ds.rows(i)(1)) then
     newSales(i).Product = ds.rows(i)(1)
     End If

     If Not DBNull.Value.Equals(ds.rows(i)(2)) then
     newSales(i).Amount = ds.rows(i)(2)
     End If

     If Not DBNull.Value.Equals(ds.rows(i)(3)) then
     newSales(i).TimeFrame = ds.rows(i)(3)
     End If

     Next

     Return newSales

   End Function

   Public Class SalesClass

    Public Region as System.String
    Public Product as System.String
    Public Amount as System.Decimal
    Public TimeFrame as System.String

   End Class

   Public function getSales(Region as String) as Datatable

    Dim cn as new SqlConnection("Data Source=local;Initial Catalog=MyDB;Persist Security Info=True;User ID=sa;password=password")
    Dim cmd As new SqlCommand("SELECT Region, Product, Amount ,TimeFrame   FROM dbo.Transaction   where Region = @Region", cn)

    Dim p0 As New SqlParameter
    p0.ParameterName ="@Region"
    p0.Value = Region
    cmd.Parameters.Add(p0)

    cn.Open()
    Dim da As New SqlDataAdapter(cmd)
    Dim dtResults As New DataTable

    Try
    da.Fill(dtResults)
    Catch ex As Exception
    da.Dispose()
    dtResults.Dispose()
    MsgBox("Something went wrong - please check the query string")
    Finally
    cn.Close()
    da.Dispose()
    End Try

    Return dtResults

   End Function

L
Top achievements
Rank 1
 asked on 19 Aug 2012
11 answers
3.6K+ views

I will make my query really simple,

I have a database in my local sqlServer

I need to bind a table to Kendo Data Source using sql connection

Is there any way to achive this ?

please post a sample application in asp.net.
Agostino
Top achievements
Rank 1
 answered on 18 Aug 2012
1 answer
274 views
Updated for clarity:

The client side grid sorting example creates data locally and assigns that data to the kendo grid rather than fetching it via a dataUrl. I am fetching the data initially via a dataUrl and setting all the properties of the dataSource.transport correctly with the autoBind set to true on the grid. After this initial fetch, I want to disconnect and have sorting/paging/filtering occur strictly client side. Is this possible?

I've not been able to get a definitive answer on this from the documentation or via numerous Google searches.  No matter what I set the datasource's serverSorting property to, I get a post to the server which resets my data.  I simply want to sort the data client side, even when it is dirty and not hit the server.    

I have wrapped the kendo grid in our own widget and have added lots of code to add/remove functionality to the kendo grid that we needed (or didn't want).  I can trap the click of the header and do our own sorting of the client data source if I have to, but before I go down that road, I want to make sure that kendo grid does NOT support a true client-side ONLY sorting.  

Thanks in advance for your time,
Rik  

Ryan
Top achievements
Rank 2
 answered on 18 Aug 2012
1 answer
346 views
I was trying to format the date in the grid.
The grid uses a editortemplate for editing date.
@model DateTime
@{
    
}
@Html.TextBoxFor(model => model, string.Format("{0:d}", Model), new { disabled="true" })

The date never gets formatted.
It always defaults to this format in the grid:
17 2012 13:36:07 GMT-0500 (Central Daylight Time)


On postback, this causes  ModelState to return error.
Ryan
Top achievements
Rank 2
 answered on 18 Aug 2012
1 answer
486 views
I am attempting to refresh a foreign key DropDownList after the list of available foreign keys has changed. I have a grid of holiday schedules with a custom action in the toolbar to allow for the CRUD of holidays. The custom action brings up a popup form to allow this. My challenge is that when the grid is first created, the list of foreign keys for the holidays is statically assigned. What I have attempted to do is react to the edit event on the grid and at that time assign a new DataSource object to the DropDownList, update the DataTextField, DataValueFied, execute read on the dataSource object, then refresh the DropDownList. This is not working. Any help would be greatly appreciated!

APS.NET MVC 3

@using ePN.Core.Domain
@using Kendo.Mvc.UI.Fluent
@model VW_HolidayDatesGridDisplay
@{
    ViewBag.Title = "Holiday Schedule";
}
@functions {
 
    private void GridCommandDef(GridColumnFactory<VW_HolidayDatesGridDisplay> columns)
    {
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
        columns.Bound(p => p.ID).Hidden();
        columns.Bound(p => p.Year).Width(50);
        columns.Bound(p => p.Month).Width(100);
        columns.ForeignKey(p => p.HolidayID, (IEnumerable<BankHoliday>) ViewBag.Holiday, "ID", "Name")
            .Title("Name")
            .Groupable(false)
            .Sortable(false);
        columns.Bound(p => p.HolidayDate).Format("{0:MM/dd/yyyy}").Groupable(false).EditorTemplateName("Date").Width(100);
    }
 
    private void GridDataSource(DataSourceBuilder<VW_HolidayDatesGridDisplay> dataSource)
    {
        dataSource.Ajax()
            .Model(AjaxDataSourceBuilder)
            .Create(create => create.Action("Holidays_Create", "Holiday"))
            .Read(read => read.Action("Holidays_Read", "Holiday"))
            .Update(update => update.Action("Holidays_Update", "Holiday"))
            .Destroy(destroy => destroy.Action("Holidays_Destroy", "Holiday"));
    }
 
    private void AjaxDataSourceBuilder(DataSourceModelDescriptorFactory<VW_HolidayDatesGridDisplay> model)
    {
        model.Id(p => p.ID);
        model.Field(p => p.Year).Editable(false);
        model.Field(p => p.Month).Editable(false);
        model.Field(p => p.HolidayID).DefaultValue(1);
        model.Field(p => p.HolidayDate);
    }
 
    private void GridToolBarDef(GridToolBarCommandFactory<VW_HolidayDatesGridDisplay> toolbar)
    {
        toolbar.Create().Text("Schedule a Holiday");
        GridToolBarCustomCommandBuilder<VW_HolidayDatesGridDisplay> popup = toolbar.Custom();
        popup.Text("Create New Holiday");
        popup.Name("NewHoliday");
        popup.Url("#");
        popup.HtmlAttributes(new {onclick = "void(openModal())", style="float:right"});
    }
 
 
}
@section PageScripts
{
    <script type="text/javascript">
        // <reference path="/Scripts/kendo.all-vsdoc.js" />
        var holidayWindow;
        var holidayDataSource = new kendo.data.DataSource({
            transport: { dataType: "json", cache: false, read: { url: "@Url.Action("BankHolidays_Read","BankHoliday",null,"http")" } },
            schema: {
                type: "json",
                data: function(response) { return response.Data; },
                model: {
                    fields: {
                         ID: { editable: false, nullable: false, type: "number" },
                         Name: { editable: false }
                    }
                }
            }
        });
 
        var rowEdit = function(e) {
            var ddl = $("#HolidayID").data("kendoDropDownList");
            ddl.dataTextField = "Name";
            ddl.dataValueField = "ID";
            ddl.dataSource = holidayDataSource;
            ddl.refresh();
            console.log(["DDL",ddl]);
        };
 
        var openModal = function () {
            var mWindow  = holidayWindow || $("#modalWindow").kendoWindow({
                actions: ["Refresh", "Close"],
                title: "Manage Holidays",
                visible: false,
                height: "400px",
                width: "600px",
                modal: true,
                draggable: false,
                resizable: false,
                content : "@Url.Action("Index","BankHoliday",null,"http")"
            }).data("kendoWindow");
            mWindow.center().open();
        };
    </script>
}
<h2>Holiday Schedule</h2>
<div id="modalWindow"></div>
@(Html.Kendo().Grid<VW_HolidayDatesGridDisplay>()
    .Name("Grid")
    .Events(e => e.Edit("rowEdit"))
    .Columns(GridCommandDef)
    .DataSource(GridDataSource)
    .ToolBar(GridToolBarDef)
    .Editable(settingsBuilder => settingsBuilder.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
    .Scrollable(settingsBuilder => settingsBuilder.Height(400))
    .Groupable()
    .Sortable()
)
David
Top achievements
Rank 1
 answered on 17 Aug 2012
1 answer
361 views
I have created a WCF Data Service that (amongst other things) contains a WebGet Method which accepts a string parameter.  How do I send this parameter from kendoUI Mobile?

WebMethod:

[WebGet]
public IEnumerable<T> GetData(string str)
{
    var linqQuery = from x in Products
                             where productName == str
                             select x;
    return linqQuery;
}

I am trying to call the webmethod as follows:

function GetProduct(name) {
    $("#product-listview").kendoMobileListView({
        dataSource: {
            transport: {
                read: {
                    contentType: "application/json; charset=utf-8",
                    url: "http://ProductDataService.svc/GetData",
                    dataType: "json",
                    data: {param: name }
               }
            },
            schema: {
                data: "d"
            },
            parameterMap: function (options) {
                kendo.ui.progress($("#product-listview"), false);
                return kendo.stringify(options);
            }
        },
        template: $("#product_template").text()
    });
}

This returns no data, and no error. Can anyone help?
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 17 Aug 2012
0 answers
89 views
Hello there,

I have the Galaxy Nexus with Android 4.1 and when I try the Forms Demo I get a weird screen behavior. When I click on an input element with type email, url, text etc. the android keyboard appears , as in every app, and I type whatever I want and when i click to a different element or click enter and the keyboard disappears I can see a white box for about a sec in the same place where the keyboard was 1 sec before. Is that a FOUC problem? And if yes how can i fix it. 

 
Afxe
Top achievements
Rank 1
 asked on 17 Aug 2012
1 answer
176 views
Hello there,

I was trying to use the upload control inside a kendo window and I noticed that when a file is selected, the file name together with a remove button will be listed 4 times under the file list.  I'm using the mvc wrapper but it seems like this is the issue with either the window or the upload widget itself.  Please let me know if you need more info on this.  Below is the code.

Thank you,

@(Html.Kendo().Window()
    .Name("window")
    .Content(@<text>
        @(Html.Kendo().Upload()
            .Name("files")
        )
    </text>)
    .Draggable()
    .Resizable()
    .Width(600)
)
Alexander Valchev
Telerik team
 answered on 17 Aug 2012
0 answers
93 views
I keep getting this exception when I do a kendo.bind
No Such Interface (IE8)
So this exception is triggered while doing a kendo.bind.
The root cause is not in the kendo code is really something in jQuery


    Sizzle.contains = function (a, b) {
                try {
                    return a !== b && (a.contains ? a.contains(b) : true); <-- Exception is here
                }
                catch (err) {
                     return false;
                }
            };
I patched my jquery file. It seems to be related to the Kendo Tabs because binding works great in all other pages not using tabs I think is it related with the enabled property of the tab control being bound.
Well I hope this can be fixed, I don't like patching my jquery  :)
Mauricio
Top achievements
Rank 1
 asked on 17 Aug 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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?