Telerik Forums
Kendo UI for jQuery Forum
1 answer
497 views
I am using ASP.NET kendo grid helper and server binding. I want to have an anchor element with its id is the concatenated string text and the dynamic value of @item.ID, so I have something like:
cols.Bound(p => p.ID)
   .Template(@<text><a id="Foo_\@item.ID" href= "#someLink" > @item.ID </a></text>);

this code works and:

.Template(@<text><a id="@item.ID" href= "#someLink" > @item.ID </a></text>);

using bare @item.ID or with "\" or "/" or "-" and other symbols, its value is dynamic indeed,
BUT if I instead use just "Foo_@item.ID", the id resulted is as is -> "Foo_@item.ID"

What should I code in order to properly concatenate strings with @item.ID in a column template?
Thanks!
Avitot
Top achievements
Rank 1
 answered on 06 Aug 2012
1 answer
143 views
Hi can you please tell me if the following approach the best for consuming the data from SQL utilizing WebService. 
The following code is working correctly. However I need to know if I'm designing dataSource correctly. At this stage I'm only intending to read the data.

DataViewModel

public class LedgerViewModel
{
    public int? lindex { get; set; }
    public int? linvoice { get; set; }
    public string lperiod { get; set; }
    public decimal? lamount { get; set; }
}

WebService

[WebMethod(Description = "Gets ledger info")]
       public List<LedgerViewModel> Read()
       {
            
           using (var db = new LedgerConnection())
           {
               return db.ledgers.Where(x => x.lmatter == "2007714")
                   .Select(l => new LedgerViewModel
                   {
                       lindex = l.lindex,
                       linvoice = l.linvoice,
                       lamount = l.lamount,
                       lperiod = l.lperiod
                   }).ToList();
           }
       }

Sample WebService Output

<ArrayOfLedgerViewModel>
  <LedgerViewModel>
    <lindex>698567</lindex>
    <linvoice>871181</linvoice>
    <lperiod>0511</lperiod>
    <lamount>0.0000</lamount>
  </LedgerViewModel>
  <LedgerViewModel>
    <lindex>698568</lindex>
    <linvoice>871181</linvoice>
    <lperiod>0511</lperiod>
    <lamount>0.0000</lamount>
  </LedgerViewModel>
</ArrayOfLedgerViewModel>

Kendo UI dataSource

dataSource: {
      transport: { }
          read: {
              url: "GetLedger.asmx/Read",
              contentType: "application/json; charset=utf-8",
              type: "POST"
          }
      },
      schema: {
          type: "xml",
          data: "/ArrayOfLedgerViewModel/LedgerViewModel",
          model: {
              fields: {
                  linvoice: "linvoice/text()",
                  lperiod: "lperiod/text()",
                  lamount: "lamount/text()"
              }
          }
      },
        sort: {
            field: "lperiod",
            dir: "asc"
        }
    }

Daniel
Top achievements
Rank 1
 answered on 06 Aug 2012
0 answers
173 views
Dear KendoUI Community,

I'am working on a WebApplication, based upon Backbone.js, Rails3 as JSON API and want now include KendoUI.

If I visit the Show-View for a selected Object (www.dogspots.de/#spots/1), my browser performs 2 JSON-Requests to the Server and I have an JS-Error: http://i48.tinypic.com/akbacn.png (Uncaught TypeError: Cannot call method 'getAttribute' of undefined)
When I disable KendoUI again, everything is fine: http://i45.tinypic.com/30t74o0.png (no JS error and 1 JSON-Request)

I believe that Backbone an KendoUI performs both an request to the server, unfortunately is KendoUI not able to parse my JSON response, which results into a JS-Error and a blank Layout

My Solution would be to disable de router-module of KendoUI and keep the work on Backbone.js. Do you agree with me?
I also tried to include your kendo.backbone.js example on github, but it doesn't changed anything.

You can also see a preview with this error on www.dogspots.de

Best regards
Gerrit
Gerrit
Top achievements
Rank 1
 asked on 05 Aug 2012
0 answers
185 views
Is the kendo upload control capable of invoking an ASP.NET webforms page method?  For instance:

        [WebMethod]
        public static string FileUpload(string id) { ... }

I see the control posting-back asynchronously, but this method is never invoked.  Here is the control creation logic:

var crudServiceBaseUrl = "Default.aspx";
 
           $("#files").kendoUpload({
               async: {
                   saveUrl: crudServiceBaseUrl + "/FileUpload",
                   autoUpload: false
               },
               multiple: false,
               showFileList: true,
           });


Dan
Daniel
Top achievements
Rank 1
 asked on 05 Aug 2012
0 answers
120 views
Hello I am testing out several UI sets for JQuery. I am really impressed with Kendo. But I am having trouble with a custom editor. I was able to get a date picker working in the grid, just not a combo box. Here is my code. It shows the box, just doesn't return the selection. I based this off your example, but can't make it work. function statusDropDownEditor(container, options) {        $('<input data-text-field="StatusName" data-value-field="StatusName" data-bind="value:' + options.field + '"/>')             .appendTo(container)             .kendoComboBox({                   dataTextField: "text",                     dataValueField: "value",                     dataSource: [                         { "text":"Open", "value":"opn" },                         { "text":"Approved", "value":"app" },                         { "text":"Declared", "value": "dec" },                         { "text":"Dispursed", "value": "dis" }                     ]});     }   This shows the drop down, however it doesn’t put the newly selected item in the field.   I am unsure as to why it wouldn’t.  Also - can I have columns protected based on the row they are on, for example on row one they are editable, but not row two? Thanks.
Dark
Top achievements
Rank 1
 asked on 03 Aug 2012
1 answer
375 views
In the below piece of code the binding seems to be one way - Model to View. However when the element value is modified the corresponding Model value is not updated. 

The Input fields load the data from the array correctly but after the data has been modified in the input fields the variables "viewModel"  and "data" are not updated. (Modify the name of Perry Sofa and click the "click" button below.)

Is there anyway I can achieve two way binding - (Model to View and View to Model)? Apologies in advance for using relative paths of the kendo and jquery js files.

<!DOCTYPE html>
<html>
<head>
    <title>Source and template binding</title>
    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
     <link href="../../../styles/kendo.common.min.css" rel="stylesheet" />
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet" />
    <script>
    var data;
    var viewModel;
    function showVM()
    {
    alert(viewModel.get('products[1].name'));
    }
    </script>
    <script id="template" type="text/x-kendo-template">
    <div>
    <input type="text" data-bind="text: name" value="${name}"></input><br>
    <input data-bind="text: unitsInStock" value="${unitsInStock}"></input><br>
    <button class="k-button" data-bind="click: deleteProduct">Delete</button><br>
</div>    
    </script>
</head>
<body>
    <div id="example" class="k-content">
    <div data-template="template" data-bind="source: products"></div>
<script>
    $(document).ready(function() {
    data = [
                { name: "Hampton Sofa", price: 989.99, unitsInStock: 39 },
                { name: "Perry Sofa", price: 559.99, unitsInStock: 17 },
                { name: "Donovan Sofa", price: 719.99, unitsInStock: 29 },
                { name: "Markus Sofa", price: 839.99, unitsInStock: 3 }
            ];
        viewModel = kendo.observable({
            products: data
        });
        kendo.bind($("#example"), viewModel);
    });
    </script>   
<input type="button" onclick="showVM()" value="click"/>
</div>
</body>
</html>
Joshua
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 03 Aug 2012
1 answer
152 views
I want to display data on particular dates, i have two array which contains some dates, if my current date matches with tht array date then i want to shoe some value from tht array.
I tried to use each loop on that array on content of calendar but its giving runtime error called Invalid Template.....Any Suggestions????

I have two array which are Two dimensional,

 

populateCalendar:

 

function (Holiday) { 

var  holidaydateList = []

//constructing holidaydatelist array from Holiday object...
$.each(Holiday, function (index, model) { 
var day = model.HolidayDate.toString();  
holidaydateList.push({ HolidayDate: day.substring(6, day.length - 2), HolidayData: model.HolidayName });
});

$("#forecastCalendar").kendoCalendar({  
//value: today, 
month: {
// template for dates in month view 
content: 
'# jQuery.each([' + holidaydateList + '],function(index,item){ #'
'# if (item.HolidayDate == +data.date) { #'
'<div style="background-color: Aqua">item.HolidayData</div>'
'# } else { #'
'<div></div>'
'# } #'
'# }); #'
'#= data.value #' 
},
footer: 
"Today - #=kendo.toString(data, 'd') #" 

});

Kumarasen
Top achievements
Rank 1
 answered on 03 Aug 2012
1 answer
212 views
As is modeled in this jsfiddle, when one selects an item via the mouse, the event is raised.  My question is, why isn't the event raised when the user clicks on the button?

Is this a bug?  In the docs it clearly states that the select event is "triggered when an item of a PanelBar is selected."
Frank
Top achievements
Rank 1
 answered on 03 Aug 2012
2 answers
195 views
I am creating a grid, and the object each row is bound to contains a complex object that I want to be able to edit and update. The object has a property that is just a number, and I want to be able to see/edit/update that number in the grid. I can make the number visible easily enough using a template, but does the grid know how to allow edits/updates to the original data source?

As an example, the object the row is bound to may look like:

data = {
    ListPrice: {
        value: 8.99
    }
}

So, I want to show "8.99" in the grid, which I can do by defining my columns like so:

columns: [
    {
        field: 'ListPrice',
        title: 'List Price',
        template: '#= ListPrice.Value #'
    }
]

But, will I be able to edit this value in the grid? And how will the grid know to update the Value property when I do the edit?

Thanks
G_P
Top achievements
Rank 1
 answered on 03 Aug 2012
0 answers
304 views
I'm writing an app to allow users to create/modify XML strings.  I'd like to use the editor for that.

    var editor = $("#templateEditor").data("kendoEditor");
    editor.paste("paste in a string" + "<xmlNode>inner text</xmlNode>");

with the above I will get the "paste in a string" and "inner text" but not the node tags.  is there a way to allow this so the user can just modify everything as text string?
Eric
Top achievements
Rank 1
 asked on 03 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?