Telerik Forums
UI for ASP.NET MVC Forum
1 answer
1.0K+ views

Hi,

In the export to Excel from Kendo grid have problem.

Can I put one field as textual, one as a date and all others as a number? When exporting, they all come to me as numbers, so I have a problem with XLSX that eats the first 0, and I would like to put that field in textual.

This is my code:

 SpreadDocumentFormat exportFormat = SpreadDocumentFormat.Xlsx;

            Action<ExportCellStyle> cellStyle = new Action<ExportCellStyle>(ChangeCellStyle);
            Action<ExportRowStyle> rowStyle = new Action<ExportRowStyle>(ChangeRowStyle);
            Action<ExportColumnStyle> columnStyle = new Action<ExportColumnStyle>(ChangeColumnStyle);
            List<ExportColumnSettings> columnsData = new List<ExportColumnSettings>();
            //columnsData.Add(new ExportColumnSettings() { Field = "RB", Title = "R.b.", Hidden = false, Format = null });
            columnsData.Add(new ExportColumnSettings() { Field = "BR", Title = "BR", Hidden = false, Format = null });
            columnsData.Add(new ExportColumnSettings() { Field = "Date", Title = "Date", Format = "{0:MM/dd/yyyy}", Hidden = false });
            columnsData.Add(new ExportColumnSettings() { Field = "Name", Title = "Naziv i sjediĆĄte", Format = null, Hidden = false });
            columnsData.Add(new ExportColumnSettings() { Field = "OIB", Title = "OIB", Format = "@", Hidden = false });
            columnsData.Add(new ExportColumnSettings() { Field = "Iznos", Title = "Iznos rn.", Format = null, Hidden = false });

 

and my settings for Cell style:

   private void ChangeCellStyle(ExportCellStyle e)
        {
            bool isHeader = e.Row == 0;
            SpreadBorder border = new SpreadBorder(SpreadBorderStyle.Thin, new SpreadThemableColor(new SpreadColor(0, 0, 0)));

            SpreadCellFormat format = new SpreadCellFormat
            {
                ForeColor = isHeader ? SpreadThemableColor.FromRgb(50, 54, 58) : SpreadThemableColor.FromRgb(0, 0, 0),
                VerticalAlignment = SpreadVerticalAlignment.Center,
                    //NumberFormat = "dd.MM.yyyy.", 
                    //NumberFormat = "@",
                TopBorder = border,
                BottomBorder = border,
          
            };
            e.Cell.SetFormat(format);
        }

 

Thnx,

Andrea

Karina
Telerik team
 answered on 26 Jan 2023
1 answer
198 views
Hi.  I inherited an MVC application that is using this version - 2013.2.6.11.340. I need to updgrade away from this, as it was discovered that there is a security issue w/anything 2020 and below.  Is ther a document that can assist me in this regards?
Anton Mironov
Telerik team
 answered on 25 Jan 2023
1 answer
749 views
I'm not able to see the Telerik menu in VS 2022 after the installation of Telerik on my machine. But my co developer was able to see the menu after the installation of telerik on his machine. I have attached screenshot of the menu from my co developer machine. Do I need to enable any settings in VS2022?
Aleksandar
Telerik team
 answered on 24 Jan 2023
0 answers
128 views

Hi!

I'm using the TileLayout which needs BodyTemplateId to Render. Inside my assigned BodyTemplateId I have this code below which works if the data from Address does not contain a hash (#) character. Say, the Address from the database is "UNIT #1 ABC BLDG" will not render the TextArea.

Code:

<script id="address-template" type="text/x-kendo-template">

      <div class="row">

           <div class="text-left col-md-1">

                 @Html.LabelFor(m => m.CompleteAddress, "Address")
        </div>
        <div class="col-md-5">
              @(Html.Kendo().TextAreaFor(m => m.CompleteAddress).Rows(2)
                .Readonly(true)
                .ToClientTemplate()
              )
        </div>

      </div>

</script>

 @(Html.Kendo().TileLayout()
        .Name("TileLayout")
        .Columns(4)
        .RowsHeight("20px")        
        .Containers(c =>
        {
            c.Add().BodyTemplateId("address-template").ColSpan(4).RowSpan(6);
        })        
    )

 

What to do?

Thanks!

RGA

Richard
Top achievements
Rank 1
 updated question on 24 Jan 2023
1 answer
558 views

I have a grid with in-line editing enabled. This works well.

There is now a requirement to disable editing of the displayed records, depending on the filter selected (at the top of the page).  I need a way to simply turn on or off editing via JavaScript .

Please note, this isn't conditional editing, the filter is selected via controls on the top of the page, which then trigger a data source read. Depending on the chosen filter date (i.e. in the past)  I need to simply disable editing of all the displayed records.

 

Thanks

Ivan Danchev
Telerik team
 answered on 23 Jan 2023
1 answer
980 views

Hi  I  am getting  the following error.

'Kendo is not defined'

I have  bundelled and include the following in _layout.cshtml

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Styles.Render("~/Content/kendo/css")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/kendo")
    @RenderSection("scripts", required: false)
</head>

and at the end body i have the following

  @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/jqueryval")

 

The layout page it self looks ok , but when I display the partial view page with data. The grid data displays as a list but not as kendo grid view  and the error shows kendo  is not defined.

Thanks

Ivan Danchev
Telerik team
 answered on 20 Jan 2023
0 answers
199 views

I have a menu, using v2022.2.802 and I need to reduce the padding on the top level of the menu.  The documentation does not include any examples on how to do this.

What styles need to be changed to reduce the padding on the menu?  I have reduced the font-size by using:-


.k-menu-link-text {
        font-size: smaller !important;
   }

But this still leaves a larger amount of padding on the top level menu.

Thanks

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 16 Jan 2023
1 answer
249 views

Is there a solution for assigning a unique ID to a table strip item?  Currently I can see an example where you can reference the TabStip item name with the following however I need to assign a unique ID because the item name of my tabs can vary. The ordinal position can vary also.

$(e.item).find("> .k-link").text()

Eyup
Telerik team
 answered on 12 Jan 2023
1 answer
178 views

Hi,

one of our customers currently has difficulties uploading multiple images asynchronous. Single images seem to be ok.

We're already using the option Batch(false), so images arrive one at a time at the server.

The uploads seem to occur simultaneously, though. Is there an option to also upload these sequentially, or do we need to use the synchronous mode in this case?

 

Ivan Danchev
Telerik team
 answered on 12 Jan 2023
1 answer
366 views

HI,

we're using the Upload control like this:

Client:

@(Html.Kendo().Upload()
        .Name("images")
        .Async(a => a
            .Save("SaveImages", "Box")
            .Batch(false)
            .AutoUpload(true)
        )
        .HtmlAttributes(new { accept = "image/*" })
        .Events(e => {
            e.Upload("upload");
            e.Remove("remove");
        })
        .DropZone(".dropZoneElement")
        .ShowFileList(false)
        .Validation(v => v.AllowedExtensions(new string[] { ".jpg", ".jpeg", ".png", ".bmp", ".gif" }))
    )
// https://docs.telerik.com/kendo-ui/knowledge-base/upload-mvc-send-additional-data
        function upload(e) {
            e.data = {
                id: @Model.ID
            };
        }

        function remove(e) {
            e.data = {
                id: @Model.ID
            };
        }

Server:


public ActionResult SaveImages(IEnumerable<HttpPostedFileBase> images, int id)
        {
            var ids = new Dictionary<string, int>();

            if(id > 0)
            {
                foreach (var image in images)
                {
                    ...
                }
            }
            
            return Json(ids);
        }

A customer of ours now has the problem, that when uploading multiple images the images-Parameter on server-side is null. Uploading single images is working. The problem is only occuring on tablets.

We currently cannot reproduce this behaviour. Is there anything we must know here which can lead to this behaviour?

Ivan Danchev
Telerik team
 answered on 11 Jan 2023
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?