Telerik Forums
UI for ASP.NET MVC Forum
2 answers
2.0K+ views

Hi,

I need ASP.NET MVC confirmation dialog with dialog result.

I have a command button. When the user click button, i want to show confirmation dialog and if user click YES, set function will be call.

I took a look at the examples. "Create Confirmation Dialog via Promises" is seems to fine. but it doesn't work at my IDE.

I also tried to kendo.confirm. it works but The result is empty when I click on the button for the second time

<div id="confirm"></div><script> $("#confirm").kendoConfirm({ content: "Do you accept?", messages:{ okText: "OK"}}).data("kendoConfirm").result.done(function(){console.log("User accepted"); }).fail(function(){console.log("User rejected");});</script>

 

Emin Inam
Top achievements
Rank 1
 answered on 23 Jan 2017
5 answers
995 views
I do not find any demo which show how to implement Master/Detail using two separated Grids. I found demo where Master Grid has Child grid embedded as template, while user click + icon the child grid appears inside master grid.

I would like to have child grid on the page like master grid without embedding it into master grid. I do not find such demo anywhere.  
Dimiter Madjarov
Telerik team
 answered on 23 Jan 2017
1 answer
478 views

Hello,

I'm creating an Kendo window with JavaScript and want to set the window title with a value from a Control from the
loaded Content in the refresh or activate Event - how to access Elements of the window Content?

 

$("<div id='win" + name + "' />").appendTo(document.body).kendoWindow({
        title: stitle,
        actions: ["Close"],
        draggable: false,
        resizable: false,
        modal: true,
        animation: {
            open: {
                effects: "slideIn:left",
                duration: 500
            },
            close: {
                effects: "slideIn:left",
                reverse: true,
                duration: 500
            },
        },
        visible: false,
        pinned: false,
        content: { url: surl, iframe: false },
        refresh: function (e) {
            $.validator.unobtrusive.parse("form");
        },
        activate: function(e) {
        },
        deactivate: function (e) {
            $(windowname).data("kendoWindow").destroy();
            e.sender.destroy();
        }
    });
    var window = $(windowname).data("kendoWindow");
    window.wrapper.addClass("gpdb-sidebar-window");
    window.open();
Ianko
Telerik team
 answered on 20 Jan 2017
1 answer
214 views

Is there a way to set the offset or the distance of an exploded piece of pie chart?

 

Stamo Gochev
Telerik team
 answered on 20 Jan 2017
2 answers
142 views
I'm having trouble getting the export to excel working, it throws  Cannot read property 'length' of undefined in jquery

 

Here is MVC Grid Declaration:

@(Html.Kendo().Grid<TransactionViewModel>()
      .Name("completedgrid")
      .Columns(columns =>
      {
          columns.Bound(m => m.StudentCode);
          columns.Bound(m => m.date).Title("Date");
          columns.Bound(m => m.amount).ClientTemplate("#=kendo.toString(data.amount,'c')#").Title("Amount");
      })
      .ToolBar(toolbar =>
      {
          toolbar.Excel();
      })
      .Excel(e =>
      {
          e.FileName("TransactionList.xlsx");
      })
      .Scrollable()
      .DataSource(dataSource => dataSource
          .Ajax()
          .Read(read => read.Action("StudentPayments_Read", "PaymentsGrid").Data("getCompletedData"))
      )
)

 

In case you need getCompletedData: 

function getCompletedData() {
        return {"id" : @ViewBag.LocationId, "date":sel};
         }

 

sel is just a string containing date information like "01 2017"

TransactionViewModel:

public class TransactionViewModel
    {
        public string StudentCode;
        public decimal amount;
        public string date;
    }

 

Everything seems pretty simple, I can't see what I'm missing. The controller was scaffolded so was the grid. I had to add the filename for the excel export, and I added the date filter.

I tried adding a proxyurl but it didn't change the result so I took it out, assuming its not needed.

Any help is appreciated,
Thank you

Daniel
Top achievements
Rank 1
 answered on 19 Jan 2017
5 answers
607 views

Hi,

I'm trying to use a mult-checkbox filter like the demo on https://demos.telerik.com/aspnet-mvc/grid/filter-multi-checkboxes.

columns.Bound(c => c.status).Title("Status").Filterable(ftb => ftb.Multi(true)); And it's client side[.ServerOperation(false)].

Currently I have "act" and "inact" value in this column. I want to show only the "act" records when the page is loaded. Is that possible to give a default or pre-checked value to the muti-checkbox?

Vince
Top achievements
Rank 1
 answered on 19 Jan 2017
1 answer
285 views

I can't seem to find any information on this.

I'd like to set the width of each tab; either to a fixed value or have the tab adjust to fit the length of the text for the tab without wrapping the text. Is this possible? 

Regards,

Shawn

 

 

Shawn
Top achievements
Rank 1
 answered on 19 Jan 2017
1 answer
991 views

Hi
I have a scenario in which I have a grid which has a child grid in it which shows up when user clicks on one column of it. Following is my code

Parent Grid has ".ClientDetailTemplateId("template")" which refers to script id "template" which has definition of the child grid.
How I can export data of both grids together when one clicks on EXPORT TO EXCEL button?
Right now it only exports PARENT grid's data..no child grid's data is being exported.

Parent Grid:
@(Html.Kendo().Grid<INDOT.SOARS.ViewModels.Models.SearchFacilitiesListViewModel>()
.Name("gvFacilitiesReport")
.AutoBind(false)
.Columns(columns =>
{
    columns.Bound(c => c.FacilityName).Title("Facility Name").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth   (100).HtmlAttributes(new {style = "color:blue;font-weight:bold"});
columns.Bound(c => c.FacilityType).Title("Type").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth(70).HtmlAttributes(new {style = "font-weight:bold"});
columns.Bound(c => c.FacilityUse).Title("Use").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth(70).HtmlAttributes(new {style = "font-weight:bold"});
columns.Bound(c => c.FacilityStatus).Title("Status").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth(70).HtmlAttributes(new {style = "font-weight:bold"});
columns.Bound(c => c.FacilityOwnerShip).Title("OwnerShip").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth(70).HtmlAttributes(new {style = "font-weight:bold"});
columns.Bound(c => c.FacilitySystemPlan).Title("System Plan").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).MinScreenWidth(70).HtmlAttributes(new {style = "font-weight:bold"});
columns.Bound(c => c.FacilityCounty).Title("County").HeaderHtmlAttributes(new {style = "white-space: normal;font-weight:bold"}).HtmlAttributes(new {style = "font-weight:bold"});
})
.ToolBar(tools => tools.Excel().Text("<i class='sprite excel' title='Export to Excel'></i>").HtmlAttributes(new {style = "background-color:Transparent"}))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new {style = "height: 490px"})
.ClientDetailTemplateId("template")
.Excel(excel => excel.FileName("FacilitiesList-" + DateTime.Now.Date + ".xlsx").Filterable(true).ProxyURL(Url.Action("Excel_Export_Save", "AdminMain", new {area = "Admin"})).ForceProxy(true).AllPages(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Read(read => read.Action("SearchFacilities", "AdminMain", new {area = "Admin"}).Data("GetParameters"))
) )

Child Grid:

<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<INDOT.SOARS.ViewModels.Models.ContactDetailsViewModel>()
.Name("gv_#=FacilityId#")
.Columns(columns =>
{
columns.Bound(c => c.ContactName).Title("Person Name").HeaderHtmlAttributes(new { style = "white-space: normal;font-weight:bold;" }).MinScreenWidth(80).HtmlAttributes(new { style = "color:blue;font-weight:bold" });
columns.Bound(c => c.FunctionName).Title("Function/Group Name(s)").HeaderHtmlAttributes(new { style = "white-space: normal;font-weight:bold" }).MinScreenWidth(60).Encoded(false).ClientTemplate("\\#= getHtmlNewLinesString(FunctionName) \\#").HtmlAttributes(new { style = "font-weight:bold" });
columns.Bound(c => c.CompanyName).Title("Company Name").HeaderHtmlAttributes(new { style = "white-space: normal;font-weight:bold" }).MinScreenWidth(60);
columns.Bound(c => c.ContactId).Hidden(true);
})
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height: 120px;width:600px" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("GetContactsList", "Contacts",new { facilityId = "#=FacilityId#" }))
)

.ToClientTemplate()
)
</script>

I would appreciate your help.
Thanks
Rizwan

Viktor Tachev
Telerik team
 answered on 19 Jan 2017
3 answers
338 views
We have a situation where our customer's network is slow and when inserting records into a grid, they'll occasionally grow inpatient and click the update button multiple times, resulting in duplicate records being saved.  I know we can set an onclick event and disable the button but I would rather not have to do that on the dozens of grids we have in our application.  Is there an easy way to set this behavior globally?
Viktor Tachev
Telerik team
 answered on 19 Jan 2017
1 answer
2.0K+ views

I have Kendo MVC Grid on my page with multi column sorting enabled. But sorting on two specific fields is not working:

1. For a column with conditional formatting done through JavaScript

2. Column with ClientTemaplate.

 

Below is my code.

@(Html.Kendo().Grid<Info>()
           .Name("Info")
           .Columns(columns =>
           {
               columns.Bound(c => c.ColumnA).Width("4%").Title("A #").Sortable(true);
               columns.Bound(c => c.ColumnB).Width("4%").Title("B #").Sortable(true);
               columns.Bound(c => c.ColumnC).ClientTemplate("#=ColumnC.Name#").Sortable(true).Width("11%").Title("C");
           })
           .Editable(edit => edit.Mode(GridEditMode.InLine))
           .Events(events => { events.Save("gridSave"); })
           .Sortable(sort => sort.SortMode(GridSortMode.MultipleColumn))
           .DataSource(source => source
               .Ajax()
               .Sort(sort => sort.Add("ColumnA").Descending())
               .ServerOperation(false)
               .Model(model =>
               {
                   model.Id(f => f.Id);
                   model.Field(f => f.ColumnA).Editable(false);
                   model.Field(f => f.ColumnB).Editable(false);
                   model.Field(f => f.ColumnC).DefaultValue(new ColumnC() { Id = 0 });
               })
               //other configuration removed
               .Events(events => { events.RequestEnd("sourceReadComplete");  })
           )
   )

 

Case 1: I am adding a css class based on a condition. Sorting is not working on this column. If I comment the code that is adding the class, then the sort works fine.

function sourceReadComplete(e) {
                var grid = $("#Info").data("kendoGrid");
                grid.one("dataBound", function () {
                    var gridData = grid.dataSource.view();
                    for (var i = 0; i < gridData.length; i++) {
                        //get the item uid
                        var currentUid = gridData[i].uid;
                        //find the row based on the uid and the custom class
                        var currentRow = grid.table.find("tr[data-uid='" + currentUid + "']");
 
                        //if the record fits the condition
                        if (gridData[i].Condition == true) {
                            currentRow.find("td:first").addClass("followup")
                        }
                    }
                });
            
        }

 

Case 2: Sorting on Column C is not working. If I bind the column directly to ColumnC.Name then sorting works. But I cannot do that as I want a dropdown for this field in Edit mode.

 

Konstantin Dikov
Telerik team
 answered on 19 Jan 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
DropDownButton
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?