Telerik Forums
UI for ASP.NET MVC Forum
1 answer
1.2K+ views
I am trying to alter the meber name of a filterdescriptor but get error Unable to cast object of type 'Kendo.Mvc.CompositeFilterDescriptor' to type 'Kendo.Mvc.FilterDescriptor'  here

If request.Filters.Any(Function(y) CType(y, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName")) Then
 
                     Dim filter As FilterDescriptor = CType(request.Filters.Single(Function(g) CType(g, Kendo.Mvc.FilterDescriptor).Member.Equals("FranchiseeName")), FilterDescriptor)
                     filter.Member = "Franchisee.Name"
 
 
                 End If

I don't know what the difference is or why I get this, I have done simular before without this problem.
Thanks

Rosen
Telerik team
 answered on 12 Dec 2014
2 answers
810 views
I have the grid defined below.  I need to be able to edit the Flag Notes column and post it back.  I have so far come up with 2 solutions that are close but don't quite fit the bill.  

#1 gives a textarea to edit in, and it works exactly how it should, except the textarea is always visible and not just when you click in the cell to edit it.  
#2 also works, it hides the text box until you click in it, and it will save the text entered.  The problem comes when double quotes are entered into the field.  then the text that is saved ends with the 'closing' ".  How do I get it to accept both single and double quotes?

#2 is really what we want with the added bonus of actually being able to save double quotes or at least prevent them, maybe replace them with singles

<div id="divSearchResults">
     
       @(Html.Kendo().Grid((IQueryable<CallListModel>)Model)
       .Name("grid")
       .Editable(ed => ed.Mode(GridEditMode.InCell))
       .Pageable()
       .Sortable()
       .Scrollable(a => a.Height("auto"))
       .Filterable()
       .DataSource(ds => ds.Ajax()
           .PageSize(Constants.MaxSearchReults)
           .Sort(sort => sort.Add("Name").Ascending())
           .ServerOperation(false)
           .Update(update => update.Action("SaveFlagComments", "Reports"))
           .Model(mod =>
               {
                   mod.Id(m => m.ID);
                   mod.Field(p => p.Zone).Editable(false);
                   mod.Field(p => p.Name).Editable(false);
                   mod.Field(p => p.CarrierCode).Editable(false);
                   mod.Field(p => p.Location).Editable(false);
                   mod.Field(p => p.DispatchPhone).Editable(false);
                   mod.Field(p => p.DispatchFax).Editable(false);
                   mod.Field(p => p.DispatchEmail).Editable(false);
               }))
       .Columns(columns =>
       {
          columns.Template(@<text></text>)
                   .ClientTemplate("<input type='checkbox' " + ViewBag.disable + 
                   "#= Contacted ? checked='checked':'' # class='chkbx' value='#= ID#' name='selectCarrier' />" +
                   "<input type='hidden' value='#= ID#' name='allCarriers' />")
                   .Width(25);
           columns.Bound(p => p.Zone).Filterable(false).Width(70);
           columns.Bound(p => p.Name).Filterable(false).Width(75);
           columns.Bound(p => p.CarrierCode).Filterable(false).Width(65);
           columns.Bound(p => p.Location).Filterable(false).Width(80);
           columns.Bound(p => p.DispatchPhone).Filterable(false).Width(70);
           columns.Bound(p => p.DispatchFax).Filterable(false).Width(70);
           columns.Bound(p => p.DispatchEmail).Filterable(false).Width(90);
           columns.Template(@<text></text>)
               .ClientTemplate(" <a href='" + Url.Action("Edit", "CarrierView", new { ID = "#=ID#" }) + "', target = '_blank' >Edit</a>").Width(30);
           columns.Bound(p => p.FlagNotes)
 #1              //.ClientTemplate("<textarea name='FlagNotes_#= ID#' cols='60' rows='3' style='height=100px'>#=FlagNotes#</textarea>")
 #2              .ClientTemplate("#=FlagNotes#<input type='hidden' name='FlagNotes_#= ID#' value=\"#=FlagNotes#\">")
               .Filterable(false).Width(120);
          // columns.Command(command => { command.Edit();}).Width(40);
       })
       )

   </div>
Paul Grothe
Top achievements
Rank 1
 answered on 11 Dec 2014
1 answer
83 views
Buenas Tardes amigos del foro disculpen por escribir en español, pero necesito ayuda de como crear un TreeView a partir de una consulta LinqToXML. Si me pueden facilitar un ejemplo en Visual Basic, estaría muy agradecido.
Daniel
Telerik team
 answered on 11 Dec 2014
1 answer
97 views
Hi there,
I've a Scheduler and a Grid, i want to update the schedule when someone create or update the items in the grid.

I've subscribed the sync event with: .Events(events => events.Sync("sync"))

then I update the scheduler:

 function sync(args) {
        $("#scheduler").data("kendoScheduler").dataSource.read();
        $("#scheduler").data("kendoScheduler").refresh();
}

it works, but if there is a server validation error the editor popup quits and the user can't see the validation error.
How can I detect a successfully update?

Server validation is implemented as in the example provided:

<script type="text/kendo-template" id="message">
    <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error"
         style="margin: 0.5em; display: block; " data-for="#=field#" data-valmsg-for="#=field#" id="#=field#_validationMessage">
        <span class="k-icon k-warning"> </span>#=message#<div class="k-callout k-callout-n"></div>
    </div>
</script>


<script type="text/javascript">
    var validationMessageTmpl = kendo.template($("#message").html());

    function error(args) {
        if (args.errors) {
            var grid = $("#grid").data("kendoGrid");
            grid.one("dataBinding", function (e) {
                e.preventDefault();   // cancel grid rebind if error occurs

                for (var error in args.errors) {
                    alert(args.errors[error].errors);
                    showMessage(grid.editable.element, error, args.errors[error].errors);
                }
            });
        }
    }

    function showMessage(container, name, errors) {
        //add the validation message to the form
        container.find("[data-valmsg-for=" + name + "],[data-val-msg-for=" + name + "]")
                 .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))
    }

</script>



Daniel
Telerik team
 answered on 11 Dec 2014
1 answer
273 views
This is driving me crazy... I want to do some formatting on the cell that is housing the .k-event after the databound event is triggered.  However, it's triggered 3 times every time the page is loaded or I navigate to a new time.  Any idea why this is happening?

Rosen
Telerik team
 answered on 10 Dec 2014
1 answer
126 views
when I make a treelist as grid detail template  and click the create button 
I got  an error like   TypeError: parent is undefined  kendo.all.js--line:103021
any way to solve it?

Thanks!
Nikolay Rusev
Telerik team
 answered on 10 Dec 2014
1 answer
169 views
I've got a chart defined as:-

@(Html.Kendo().Chart<WT_Portal_PMS2.Models.OpenClockSummary>()
       .Name("chart")
       .Title("Open Clocks by Weeks Waiting")
       .Theme("bootstrap")
       .Legend(legend => legend
           .Position(ChartLegendPosition.Top)
           .Visible(false)
       )
                   .DataSource(ds => ds.Read(read => read.Action("_BarChartp", "Summary")
                              .Data("specFilter")
 
                   ))
       .Series(series =>
       {
           series.Column(model => model.Clocks, model => model.barColour);
 
 
 
       })
       .ChartArea(area => area
           .Height(350)
           .Background("transparent"))
       .CategoryAxis(axis => axis
           .Categories(model => model.CurrentWaitingBand)
           .Labels(labels => labels.Rotation(-90))
           .MajorGridLines(lines => lines.Visible(false))
       )
       .ValueAxis(axis => axis.Numeric()
           .Labels(labels => labels.Format("{0:N0}"))
           .Line(line => line.Visible(false))
       )
       .Tooltip(tooltip => tooltip
           .Visible(true)
           .Format("{0:N0}")
       )
 
                   )

What I need to do is add a boostrap badge to the chart title, so each one of the charts has an easily idfentifiable reference number.
E.g:-
<span>Open Clocks by Weeks Waiting</span>  <span class="pull-right badge">C1</span>

How can I put this markup into the title? Any attempt to add spans etc., result in javascript errors when the page is run.

Thanks
T. Tsonev
Telerik team
 answered on 10 Dec 2014
1 answer
640 views
Hello,

I am displaying  popup window from parent displaying a  partial view. When the partial view loads my parent window URL is already changing to Controller/Action for partialview. When i submit the partial view i do not want to refresh the parents window. Submitting partial view should just Close Pop up  window. How can i achieve this. parent window method to Show popup window code is like this
var direction = "ObjectDetail/Index";
var wnd = $("#ObjectDetail").data("kendoWindow");
if (wnd) {
wnd.refresh({
url: direction,
data: { id: item.id }

});
wnd.element.css("visibility", "");
wnd.center();
wnd.open();
}
At this Point when child window Pops up parent window URL is changing to this new URL.

The partial view has beginform
@using (Html.BeginForm("SubmitFormCollection", "ObjectDetail"))
{
and on submit the actionresult i have to Redirect to parent URL again and this refreshes parent view
      [AcceptVerbs(HttpVerbs.Post)]
         public ActionResult SubmitFormCollection(ControlsContext selModel, FormCollection formCollection)
         {
   //do something
              return RedirectToAction("Index", "ObjektActivity");         }

How can i submit the popup window and Close it without refreshing parent.

Anamika
Anamika
Top achievements
Rank 1
 answered on 09 Dec 2014
1 answer
211 views
I am trying to filter the Grid based on what the user types.  One of my fields is a drop down list and if the foreignKey ID is null the filter breaks because it cannot get the value.  

The field is Gender.  Is there a way to first check if Gender_Id is null before I check Gender_Types.Gender?  Because if Gender_Id is null then so is Gender_Types.

Here is my code:



// Filter the Grid as a user types
    $("#Search").on("keyup click input", function () {
        grid = $("#Grid").data("kendoGrid");
        var searchFilter = { logic: "and", filters: [] };

        if (this.value.length > 0) {
            var search = this.value.trim();
            var search_array = search.split(" ");
            for (var i = 0; i < search_array.length; i++) {
                var filter = { logic: "or", filters: [] };

                filter.filters.push({ field: "Full_Name", operator: "contains", value: search_array[i] });
                filter.filters.push({ field: "Gender_Types.Gender", operator: "contains", value: search_array[i] });

                searchFilter.filters.push(filter);
            }

            grid.dataSource.query({ filter: searchFilter });

            // When done filtering select page one otherwise no page is selected
            grid.dataSource.page(1);

        } else {
            grid.dataSource.query({ filter: searchFilter });

            // When done filtering select page one otherwise no page is selected
            grid.dataSource.page(1);
        }
    });











Petur Subev
Telerik team
 answered on 09 Dec 2014
1 answer
178 views
Hello,

I'm trying to show the redline you can see in timeline view at http://www.telerik.com/kendo-ui/ganttchart (also in attached file).
How I can do it? I don't see any option to enable it. I'm actually not using Dependencies between task or additional Resource.

Anyway, it's supposed to show the actual time (today) from the timeline? or what's his purpose?
Vladimir Iliev
Telerik team
 answered on 08 Dec 2014
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
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
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?