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

The background color of the Main panel item and the sub panel items.  Can someone help me set the background color of the subitems to something different.

For example, when I click on Q1 Forecast I would like it be Red to give a visual indication that you have selected a sub item.  Sales Forecast should remain Aqua Blue which is set from the Theme.

 

Ivan Danchev
Telerik team
 answered on 06 Feb 2023
1 answer
158 views

Hi,

May I know what to install/need for editable PDF (eg: PDF editor)?

I've go through this blog https://www.telerik.com/blogs/editing-pdf-files-in-browser-adding-signature-text-images .

But I failed to get the result as follows:

Much appreciate if you can reply ASAP. Thank you! 

Ivan Danchev
Telerik team
 answered on 02 Feb 2023
2 answers
277 views

I've tried a multitude of options, but the ones that don't throw errors, I get "/Date(16400...." as the results

Here are some of the tries.

columns.Add().Field("StartDate").Title("Start Date").Template("#:kendo.toString(StartDate,'MM/dd/yyyy')#").Width("150px");

columns.Add().Field("StartDate").Title("Start Date").Template("#:data.StartDate.ToString('MM/dd/yyyy')#").Width("150px");

columns.Add().Field("StartDate").Title("Start Date").Template("#= kendo.toString(StartDate, 'MM/dd/yyyy')#").Width("150px");

 

I did see the one user voice asking for a "Format" method for MCCB as getting the escape correct is difficult but didn't give any examples.

using Telerik.MVC 2022.3.1109

Eyup
Telerik team
 answered on 02 Feb 2023
0 answers
263 views

i have a kendo grid which has .pageable.pageSizes(new[] {20,50,100,250})

when i try and select a page size from the drop down list i get an error:

this is the code that sets up the grid

as a result of the error the page size isnt updated.

 

 

NOTE: THIS HAS BEEN FIXED, IT WAS AN ISSUE WITH A HEAD SCRIPT

Daniel
Top achievements
Rank 1
 updated question on 02 Feb 2023
1 answer
163 views

 am using Azure Ad authentication in my ASP.Net 4.8 MVC application. When authentication is expired and when user clicks on the link or button user get redirected to login page. So that is good.

However, I have a problem with AutoComplete textbox which is also available on the same page among buttons and link. If user leave the app open and comes back after page authentication cookie is expired and enter a value in autocomplete textbox, then textbox doesn't do anything, it works as there is no data to filter and doesn't even throw an error. I would expect it to redirect user to login page or refresh the token.

I suppose that could be known to those who uses Jquery or ajax functions or telerik controls to how to check for token. I am just new to all that.

Just in case if the code is needed so here it is.

  <form action="@Url.Action("Transaction", "Job")" method="POST">
            <div>
                <div class="col-xs-4 k-content py text-left">

                    @{
                        try
                        {
                            @(Html.Kendo().AutoComplete()
                    .Name("searchValue")  //chaninging the name of the class to UserModel
                    .DataTextField("SearchString") //DataTextField("dataField")
                    .Filter("contains")
                    .MinLength(2)

                    .HtmlAttributes(new {style = "width:100%"})
                    .DataSource(source =>
                    {
                        source.Read(read =>
                        {

                            read.Action("GetAutoComplete", "Job")
                                .Data("onAdditionalData");
                        })
                            .ServerFiltering(true);
                    })
                    //.Events(e => e.DataBound("onDataBound"))
                    )

                        }
                        catch (Exception e)
                        {
                            //this.RedirectToAction("Reporting", "ReportManagement");
                        }

                    }
Anton Mironov
Telerik team
 answered on 01 Feb 2023
1 answer
1.6K+ views
How do you make Html.Kendo().Button() submit a form?
Anton Mironov
Telerik team
 answered on 01 Feb 2023
1 answer
487 views

I'm trying to reduce the clutter on the grid column headers. I love the idea of giving the users the power to hide and show columns but do not want to see those 3 dots on every column. For all other columns i just want the filter icon present.

I want to show the column menu only for the first column (first column is a selector checkbox). Version would be the latest and greatest. Is this possible?

 

Eyup
Telerik team
 answered on 31 Jan 2023
5 answers
621 views

Hello everyone,

I have a little problem with editing my grid and I hope you can help me.

I am currently developing a grid (Telerik UI for ASP.NET MVC Grid) in which you can open another grid using a button at the end of the row. In this second grid it is possible to select one or more employees (Inline Editing with a DropDown) for the previous entry. In addition to the actual employee, there is another column where you can set a checkbox to "true" or "false". You can create a new entry with the button on the top left and you can edit or delete it with the two buttons on the right in the line.

Now to my question: My plan is that the name of the employee can only be changed when creating the entry. If you click on Edit, the name should no longer be editable, only the checkbox should be.

How exactly do I do this?

I had the idea to set the field "UserId" to .Editable(false) under .Model. But if I do that, I can neither change the value when creating nor when editing. When creating the entry, the drop-down menu for selecting an employee should be available, but not when editing.

In the attachments I have pictures showing the grid exactly.

Thanks in advance
Lars

 

@(Html.Kendo().Grid(Model)
    .Name("AssignmentsGrid")
    .Columns(c =>
    {
        c.ForeignKey(m => m.UserId, (IEnumerable) ViewData["users"], "Id", "Name").EditorTemplateName("ProjectUserDropdown");
        c.Bound(m => m.Resigned).ClientTemplate("<input type='checkbox' #= Resigned ? checked='checked' :'' # disabled='disabled' />");
        c.Command(command =>
        {
            command.Edit();
            command.Destroy();
        });
    })
    .ToolBar(t => t.Create())
    .Events(events =>
    {
        events.Edit(@<text>function(e) { if(e.model.isNew()) { e.model.set('ProductionOrderId', @ViewData["productionOrderId"]); } else { $('[name="ProjectManagerId"]').attr("readonly", true); }} </text>);
    })
    .DataSource(s => s
        .Ajax()
        .Create(c => c.Action("UserAssignmentAdd", "ProductionOrder", new {area = "Sktcrm"}))
        .Read(r => r.Action("UserAssignmentRead", "ProductionOrder", new {area = "Sktcrm"}).Data(@<text>function(e) { return { productionOrderId: @ViewData["productionOrderId"] }; }</text>))
        .Update(u => u.Action("UserAssignmentUpdate", "ProductionOrder", new {area = "Sktcrm"}))
        .Destroy(d => d.Action("UserAssignmentDelete", "ProductionOrder", new {area = "Sktcrm"}))
        .Model(m =>
        {
            m.Id(model => model.UserId);
            //m.Field(t => t.UserId).Editable(false);
        })
        .ServerOperation(false))
    .Scrollable()
    .Sortable()
    .Filterable())


Eyup
Telerik team
 answered on 27 Jan 2023
1 answer
260 views

Greetings,

 

I'm working on an issue with our Kendo UI...essentially i have a parent node and i want to add a child node and have the change show up immediately like it does in the Kendo UI example.  Upon clicking Add for a new child node, i can enter my details and update the row. 

In the example shown here: https://demos.telerik.com/aspnet-mvc/treelist/editing you'll see once the update button is clicked the row automatically updates and you can see the child node you've created.

My issue is that once i click the update button the row disappears and only a page refresh will show the new child node row.

The error i get when trying to update the row is a generic: POST http://localhost:16922/Rackhouses/RackhouseTreeList_Add 500 (Internal Server Error)

Here's my cshtml for the treelist:


@(Html.Kendo().TreeList<WhiskeySystems.ViewModels.RackhouseTreeListItemVM>
    ()
    .Name("treelist")
    .Toolbar(toolbar => toolbar.Create().Text("Add Rackhouse"))
    .Columns(columns =>
    {
        columns.Add().Field(e => e.Name).Title("Name").Width(220);
        columns.Add().Field(e => e.InMyBond).Title("In My Bond").Width(100).Template("<input type='checkbox' data-bind='checked: InMyBond' onclick='return false;'/>" );
        columns.Add().Field(e=> e.Tiers).Title("Tiers");
        columns.Add().Field(e => e.Rows).Title("Rows");
        columns.Add().Field(e => e.Capacity).Title("Capacity");
        columns.Add().Width(300).Command(c =>
        {
            c.Edit();
            c.Destroy();
            c.CreateChild().Text("Add Zone");
            c.Custom().Name("defaultZone").ClassName("zoneDefault").Click("setDefaultZone").Text("Set Default");
        });
    })
    .Editable(e=>e.Mode("inline"))
    .DataSource(dataSource => dataSource
    .Create(create => create.Action("RackhouseTreeList_Add", "Rackhouses"))
    .Read(read => read.Action("RackhouseTreeList_Read", "Rackhouses"))
    .Update(update => update.Action("RackhouseTreeList_Update", "Rackhouses"))
    .Destroy(delete => delete.Action("RackhouseTreeList_Delete", "Rackhouses"))
    .Events(e=> { e.Error("onError"); e.RequestEnd("requestEnd"); })
    .Model(m => {
        m.Id(f => f.Id);
        m.ParentId(f => f.ParentId);
        m.Expanded(true);
        m.Field(f => f.Capacity);
        m.Field(f => f.DistilleryId);
        m.Field(f => f.InMyBond);
        m.Field(f => f.InvTypeId);
        m.Field(f => f.Name);
        m.Field(f => f.Rows);
        m.Field(f => f.Tiers);
    })

    )
    .Events(e => { e.DataBound("OnDataBound"); e.Edit("OnEdit"); })

    )


Heres my TreeList Add code for the controller:

 


public JsonResult RTreeList_Add([DataSourceRequest] DataSourceRequest request, RTreeListItemVM VM)
        {
            using (var contextScope = _scope.Create())
            {
                try
                {

                    _RBS.AddRTreeListItemVM(VM);
                    contextScope.SaveChanges();
                    //Assign the new Id back to the VM after saving.
                    if (VM.ParentId.HasValue)
                    {
                        VM.Id = VM._zone.Id + 0.2m;
                    }
                    else
                    {
                        VM.Id = VM._r.Id + 0.1m;
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Error", ex.Message);
                }

                return Json(new[] { VM }.ToTreeDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
            }
        }









                   

 

 

I've done quite a bit of troubleshooting and cant seem to find anything that stands out.  Made sure my scripts are running in the right order.  Im new to kendo so still trying to ramp up my knowledge here.  Thanks in advance!

 

                   
Eyup
Telerik team
 answered on 26 Jan 2023
1 answer
869 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?