Telerik Forums
UI for ASP.NET MVC Forum
1 answer
221 views
I am using the grid control and having a problem where it is not sorting on a column that is being calculated.  Here's the relevant part of my controller, where I'm performing my LINQ query:

                             select new Models.ApplicationModels.CustomerModel
                             {
                                 CustomerID = instance.CustomerID,
                                 CustomerOrders = GetCustomerOrders(instance.CustomerID)
                             };

This all displays perfectly fine.  I can sort on CustomerID, but I can't sort on CustomerOrders.  I'm not doing anything special with the binding, just calling it the same way as CustomerID.  

How can I get this to sort properly?  Would it help if I moved the logic of GetCustomerOrders into a SQL function and made it a computed column there?  I should note that I'd like to be able to sort this across all Customer entities -- and I am looking at a lot of data (millions of rows).  If there is a better way of handling this I'm open to suggestions.

Petur Subev
Telerik team
 answered on 18 Apr 2013
1 answer
121 views
My insert button inside Ajax.beginform().
<div id="createDescriptors">
@using (Ajax.BeginForm(

"InsertDescriptors",
new { id = Model.CitationID},

new AjaxOptions()
{

UpdateTargetId = "createDescriptors",
HttpMethod = "post",


}


) )

{

<div class="grid">
<div class="row gridRow">
<div class="span1">
<input type="image" id="btnInsertDes" src="~/Content/Icons/Add.png">
Insert
</div>
<div class="span1">
<input type="image" id="btnEditDes" src="~/Content/Icons/Edit.png" >
Edit
</div>
<div class="span1">
<input type="image" id="btnDeleteDes" src="~/Content/Icons/Delete.png">
Delete
</div>
<div class="span1">
<input type="image" id="btnSaveDes" src="~/Content/Icons/Save.png" >
Save
</div>

</div>
</div>
 
and here is my controller Action method:
public JsonResult InsertDescriptors([DataSourceRequest] DataSourceRequest request, CitationDescriptor citationDescriptor, int id)
{

citationDescriptor.CitationID = id;
citationDescriptor.DBProviderID = 1;

if( citationDescriptor != null && (ModelState.IsValid))
{
Db.Descriptors.Add(citationDescriptor);
Db.SaveChanges();
}

return Json(new[] { citationDescriptor }.ToDataSourceResult(request, ModelState), "application/json");


}

Thanks for your help!
VANDANA
Petur Subev
Telerik team
 answered on 18 Apr 2013
1 answer
89 views
I have a detail grid where I want to display a specified number of items.
My master grid item have a Quantity columns that is 6, for example. And for detail items, in database, is set that I need to have 4 of type A, and 2 of type B.
and the user *MUST* fill all the 6 lines.

in controller I add 6 items to the list, 4 for type A, 2 for type B, for each type, while needed:
list.Add(new Editable
                    {
                        Id = -1,
                        MasterId = masterId,
                        Type = TypeCode
                    });

but when I try to save it, I got this error in jquery.min.js:
Unhandled exception at line 3, column 5099 in http://localhost:60455/Scripts/kendo/jquery.min.js
 
0x800a138f - Microsoft JScript runtime error: 'length' is null or not an object
Is there a way to work this out?

Thanks,
Ezequiel
Daniel
Telerik team
 answered on 18 Apr 2013
1 answer
194 views
I want to have the selected items in the multi-select helper render vertically (instead of the default horizontal).  I tried using a custom tagTemplate that added a break tag, but all that did was put the "X" for removing below the text of the tag.  How can I do this?

Dane
Iliana Dyankova
Telerik team
 answered on 18 Apr 2013
1 answer
367 views
In our database, we use 0 (which resolves as 1/1/1900) for dates.

We don't have nullable dates.

What is the best practice such that dates that come into the model is 0 (or1/1/1900), format so in display mode they appear as "--" or "n/a" or "", while in edit mode, the control shows an empty box, instead of 1/1/1900?


Vladimir Iliev
Telerik team
 answered on 18 Apr 2013
3 answers
224 views
Hey,

I want to use KendoUI on the top of my ServiceStack project.
What is the recommended way to use ? I heard that the MVC of KendoUI wrappers are not compatible with HTML-Helpers of ServiceStack ?

So it would be nce to know why ?
Can I use it without the MVC wrappers of KendoUI - if yes - what's the best case ?

best wishes
Norbert

PS: ServiceStack
Atanas Korchev
Telerik team
 answered on 18 Apr 2013
1 answer
796 views
I have a grid that have a template column with an anchor to open a window popup when it is click. I need to pass the id of the line where I'm clicking the anchor, but I can get how to pass that value.

I'm attaching my code


@(Html.Kendo().Grid(Model.QuoteRequests)
                .Name("MultilineGrid")
                .Resizable(resizable => resizable.Columns(true))
                .Scrollable()
                .EnableCustomBinding(true)
                .Selectable(selectable => selectable
                    .Mode(GridSelectionMode.Multiple))
                    
                .Columns(columns => {
                    columns.Bound(qr => qr.QuoteRequestId).Hidden();
                    columns.Template(@<text><a href="#" onclick= "OpenNotes(#=QuoteRequestId#)" class = 'k-button k-button-icontext'> Notes </a></text>).Width(100);
                    }
                })

Dimiter Madjarov
Telerik team
 answered on 18 Apr 2013
1 answer
444 views
Hi,

i want fix width of column in kendoGrid, i tried using width:100px but when text is too long like
 (Ex. asgfsgdajhdkjashdasdklaskdljaslkdjlkasj) column width aoutomatically incresed,
 is there any way to handel overflow text or nowrap property to break text and add it to next line.
Dimiter Madjarov
Telerik team
 answered on 18 Apr 2013
4 answers
398 views
I'm having problems when trying to format the date that's displayed on a grid.

With the following code:
@(Html.Kendo().Grid(Model.Users)
      .Name("Grid")
      .Columns(columns =>
                   {
                       columns.Bound(u => u.UserView.CreatedOn).Format("{0:g}");
                       columns.Bound(u => u.UserView.ID).Title("").Sortable(false).Width(100)
                           .ClientTemplate("<a class='button' href='" +
                                              Url.Action("EditUser", "Admin") +
                                              "/#= UserView.ID #'" +
                                              ">Edit</a>"
                           );
                   })
      .Pageable()
      .Sortable()
      .Scrollable(scr => scr.Height(400))
      .Resizable(resize => resize.Columns(true))
      .DataSource(dataSource => dataSource.Ajax().ServerOperation(false)))
The date appears unformatted (e.g. /Date(1361292162723)/) and the edit button appears in the other column (see the edit image).

If I change the code so that the date column uses a client template with the date formatting:
@(Html.Kendo().Grid(Model.Users)
      .Name("Grid")
      .Columns(columns =>
                   {
                       columns.Bound(u => u.UserView.CreatedOn).ClientTemplate("#=CreatedOn ? kendo.format('{0:d}', kendo.parseDate(CreatedOn)) : ''#");
                       columns.Bound(u => u.UserView.ID).Title("").Sortable(false).Width(100)
                           .ClientTemplate("<a class='button' href='" +
                                              Url.Action("EditUser", "Admin") +
                                              "/#= UserView.ID #'" +
                                              ">Edit</a>"
                           );
                   })
      .Pageable()
      .Sortable()
      .Scrollable(scr => scr.Height(400))
      .Resizable(resize => resize.Columns(true))
      .DataSource(dataSource => dataSource.Ajax().ServerOperation(false)))
Then the date formats correctly but the edit button in the other column no longer appears. It just shows the ID as a string (see the noedit image).

How can I get the date to format correctly and have the other client template working?
Daniel
Telerik team
 answered on 18 Apr 2013
1 answer
194 views
Hi,
While retrieving the value of dropdownlist I am getting 'undefined'. here is my code: 

 @(Html.Telerik().DropDownList()
          .Name("cmbInvoieNo")
          .BindTo(new SelectList(Model.PIModel, "InvoiceID", "InvoiceName"))
                   .Placeholder("Select Invoice Number...")
                   .HtmlAttributes(new { style = "width: 230px; float: left;" })
                                    ) 
 <div><button type="submit" class="t-button t-state-default" onclick="getInvoiceNo()"> @Model.ButtonCaption</button> </div>
----------------------------------------------------------------------------------------------
@{
    <script type="text/javascript">
              function getInvoiceNo() {
            var cmbInvoice = $("#cmbInvoieNo").data("tDropDownList").text();            
            alert(" Invoice1 : " + cmbInvoice);
        }      
   </script>
}

--- On Click of 'Submit' button : $("#cmbInvoieNo").data("tDropDownList").text() return 'undefined' 
$("#cmbInvoieNo") ---  'defined'
$("#cmbInvoieNo").data("tDropDownList") ------- undefined

any Idea what could be wrong ??

Khem
Top achievements
Rank 1
 answered on 18 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?