Telerik Forums
UI for ASP.NET MVC Forum
1 answer
86 views

Hello I'm trying to load a load on demand tree on document.ready according to a path like shows this jsbin:

http://jsbin.com/ESOjAmi/8/edit?html,css,output

The problem in my case is that exist child nodes that have the same id as parents, because are two different entities, so in those cases the parent is expanded but the children that i want to select and trigger the select event is not selected i guess because the method get in the datasource returns the first node that match the id.

The problem is in this part of the code because in the case of the path [1,1] for example it expands the parent node but not the children with id 1 and i want to trigger the select event of the children node.

 else {
        // otherwise select
        node = treeview.findByUid(ds.get(path[0]).uid);
        treeview.select(node);
        treeview.trigger("select", { node: node });
      }

Maybe you can modify the example to reflect my case please?

Thank you

Ivan Danchev
Telerik team
 answered on 27 Jul 2016
4 answers
244 views

I found following problem:

I have one main view MainView with two different partial views ViewOne and ViewTwo returned to the main view by separate @HTML.RenderAction(Action, controller) methods from different controllers . The partial views renders Ajax form with model fields in the first view and  KendoDataGrid in the second partial view.Both views uses different data models but  one field in each model has the same name. eg ForeignKey_ID.

When I try to edit a row in the second view (data grid) the row goes to edit state but instead of a dropdown with names/labels for ForeignKey_ID a text box with default id numerical value appears. In the same time missing dropdown shows up just by the dropdown for  ForeignKey_ID field in the first partial view (Ajax form)

I tried to use different field in the second view (datagrid) so there was no the same field name in the whole page and then expected dropdown with dictionary values shown up properly.

It can be solved by changing affected field name in the model.

Is there any other solution for this ?

 

 

ForeignKey_ID
Konstantin Dikov
Telerik team
 answered on 27 Jul 2016
4 answers
1.3K+ views

I have a grid, I want to fire the event edit like I'm clicking the edit button to fire the popup edit template, but without clicking it with the mouse but programatically. I this posible?

I tried trigger it on the databound event like this:

 

for (var i = 0; i < rows.length; i++) {

if(Myid == theIdOntheRow)

{

 $(rows[i]).addClass('k-state-selected');
                        var btnEdit = $(rows[i]).find(".k-grid-edit");                        
                        btnEdit.trigger('click');

 

...

 

I hope there are a clenear way to do this. Thanks

Dimiter Madjarov
Telerik team
 answered on 27 Jul 2016
1 answer
83 views

So, I've been spending roughly a day extra coding javascript and testing my code only to find that the date in data-value of the td elements are one month behind.

I'm posting a screenshot. now my question is, is this considered a bug? it's not hard for me to compensate for this, but I'd hate to change it again after a brief bug fix patch. please get back to me on this.

Viktor Tachev
Telerik team
 answered on 27 Jul 2016
2 answers
229 views

public class FavoritesController : Controller
    {
        public IActionResult Favorites_Read([DataSourceRequest] DataSourceRequest request)
        {
            ...

            return Json(listings.ToDataSourceResult(request));
        }
    }

 

@(Html.Kendo().ListView<ListingDetails>()
    .Name("listView")
    .TagName("div")
    .ClientTemplateId("listingTemplate")
    .Pageable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(5)
        .Model(model => model.Id(p => p.ID))
        .Create(update => update.Action("Favorites_Create", "Favorites"))
        .Read(read => read.Action("Favorites_Read", "Favorites"))
        .Update(update => update.Action("Favorites_Update", "Favorites"))
        .Destroy(update => update.Action("Favorites_Delete", "Favorites"))
    )
    .Deferred()
    )

 

I've set a breakpoint at the beginning of Favorites_Read, but the action is not being hit. Any help would be greatly appreciated.

Konstantin Dikov
Telerik team
 answered on 27 Jul 2016
5 answers
393 views

Hello I have some trouble with a grid, when i try to add a Template in order to generate a personalizated Pdf file.

I wrote many times the example is shown by Telerik, but I only get a grid without  the template.

I can´t see the pagination #pages nr etc.

My code is:

<style>
    /*
        Use the DejaVu Sans font for display and embedding in the PDF file.
        The standard PDF fonts have no support for Unicode characters.
    */
    .k-grid {
        font-family: "DejaVu Sans", "Arial", sans-serif;
        width: 750px;
        height: 350px;
    }

    /* Hide the Grid header and pager during export */

    .k-pdf-export .k-grid-toolbar,
    .k-pdf-export .k-pager-wrap {
        display: none;
    }
</style>


<!-- Load Pako ZLIB library to enable PDF compression -->
<script src="~/Scripts/pako.min.js"></script>


<script type="x/kendo-template" id="page-template">
    <div class="page-template">
        <div class="header">
            <div style="float: right">Page #: pageNum # of #: totalPages #</div>
            Multi-page grid with automatic page breaking
        </div>
        <div class="watermark">KENDO UI</div>
        <div class="footer">
            Page #: pageNum # of #: totalPages #
        </div>
    </div>
</script>

<div class="box wide">
    <p style="margin-bottom: 1em"><b>Important:</b></p>

    <p style="margin-bottom: 1em">
        This page loads
        <a href="https://github.com/nodeca/pako">pako zlib library</a> (pako_deflate.min.js)
        to enable compression in the PDF. This is highly recommended as it improves
        performance and rises the limit on the size of the content that can be exported.
    </p>

    <p>
        The Standard PDF fonts do not include Unicode support.

        In order for the output to match what you see in the browser
        you must provide source files for TrueType fonts for embedding.

        Please read the documentation about
        <a href="http://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#custom-fonts-and-pdf">custom fonts</a>
        and
        <a href="http://docs.telerik.com/kendo-ui/framework/drawing/pdf-output#using-custom-fonts">drawing</a>.
    </p>
</div>

@(Html.Kendo().Grid<Bams.Models.ListePdf>()
        .Name("grid")
        .ToolBar(tools => tools.Pdf())
        .Pdf(pdf => pdf
            .AllPages()
            .AvoidLinks()
            .PaperSize("A4")
            .Scale(0.8)
            .Margin("2cm", "1cm", "1cm", "1cm")
            .Landscape()
            .RepeatHeaders()
            .TemplateId("page-template")
            .FileName("Kendo UI Grid Export.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Test"))
        )
        .Columns(columns =>
        {
            columns.Bound(c => c.Id)
              .Width(20).Title("Nr");
            columns.Bound(c => c.Name).Width(50).Title("Name");
            columns.Bound(c => c.Beschreibung).Width(50).Title("Beschr.");
            columns.Bound(c => c.Hersteller).Width(30).Title("Herst.");
            columns.Bound(c => c.Alias).Width(30).Title("Alias");
            columns.Bound(c => c.Datums).Width(20).Title("Datum");
        })
        .HtmlAttributes(new { style = "height: 550px;" })
        .Scrollable()
        //.Groupable()
        .Sortable()
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("getListe", "Test"))
            .PageSize(2)
        )
)
<style>
    /* Page Template for the exported PDF */
    .page-template {
        font-family: "DejaVu Sans", "Arial", sans-serif;
        position: absolute;
        left: 20px;
        right: 20px;
        font-size: 40%;
    }

        .page-template .header {
            top: 10px;
            border-bottom: 1px solid #000;
        }

        .page-template .footer {
            bottom: 10px;
            border-top: 1px solid #000;
        }
</style>

 

What is Wrong?????

Frank
Top achievements
Rank 1
 answered on 27 Jul 2016
1 answer
286 views

Hi

 

I am using databinding in my MVC view with ComboBoxFor (see sample below).

This works great when I am using this the first time (new record). However, when I want to Edit my entity, I want that upon opening the view, the ProductName is already there. How to accomplish this? If I set the .Text property then this is showed, but the binding gets lost when I save. Is there a way set force a call to the controller to get the ProductName based upon the bound MyProductId?

 

@(Html.Kendo().ComboBoxFor(m => m.MyProductID)
          .Placeholder("Select product")
          .DataTextField("ProductName")
          .DataValueField("ProductID")
          .HtmlAttributes(new { style = "width:100%;" })
          .Filter("contains")
          .AutoBind(false)
          .MinLength(3)
          .DataSource(source => {
              source.Read(read =>
              {
                  read.Action("GetProducts", "Home");
              })
              .ServerFiltering(true);
          })
    )

Danail Vasilev
Telerik team
 answered on 27 Jul 2016
4 answers
229 views

Hi, I'm new here.

 

I'm developing a site which uses the Calendar, one requirement is that I need to be able to color the days of the month depending on the model state.

 

I've seen a couple of examples that has the Calendar declared in javascript, I'm working with Razor, in a .cshtml file. I can freely access a property in the model to return a CssClass string.

my calendar is written like this.

@(Html.Kendo().Calendar()
                  .Name("Trafikkalender")
                  .Culture("sv-SE")
                  .HtmlAttributes(new {style = "width: 100%;"})
                  .Events(e => e.Change("DateClick").Navigate("Navigate"))
                  .Format("dd MM yyyy")
                  
                  )

I know I need the .MonthTemplate("") property for my purpose, but I don't know what the syntax is for the string. the Model object returns a custom date object with a DateTime as input, how would I accomplish my goal? the examples and demos I've found here are very poorly commented/explained, I need more information.

Viktor Tachev
Telerik team
 answered on 27 Jul 2016
1 answer
93 views

I created a hierarchical grid where I need to edit a cell in the child template grid.

I can get the parent grid to work but the edit button does not show up in the child grid, nor does the select row function work either.

I am doing this in vb with MVC. I also tried adding the Editable attribute but that didn't work either.

Scott
Top achievements
Rank 1
 answered on 26 Jul 2016
6 answers
2.6K+ views

Hello.

 I have been googling this all day to no avail.  I need to add a third parameter to the following:

columns.Bound(p => p.Line).ClientTemplate(
    "<a href='" +
    Url.Action("Details", "OrderLine") +
    "?OrdId=#= OrdId #&Line=#=Line#'" +
    ">#=Line#</a>"
);

 

I have tried different combinations and none have seemed to pass the third parameter to the details screen (OrdType is the parameter).  I can pass two of the parameters using the above, but I am not sure how to pass the third.  I appreciate any help.

Thank you.

 

 

Raul
Top achievements
Rank 1
 answered on 26 Jul 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
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
Iron
Iron
Sergii
Top achievements
Rank 1
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?