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

Hi,

I have a requirement of validation in server side. During adding a new record and update few old records in Kendo Grid and click on Save button it calls the Create and Update method asynchronously. But when i am adding a new record based on its value i need to validate in update method.

But when click on Save button i calls the Create and Update method asynchronously so my validations doesn't work as expected.

Can we run the Create and Update method synchronously one after another when i am adding a new row and update few old row values and click on Save button.

 

Mihaela
Telerik team
 answered on 03 Dec 2024
1 answer
55 views

Hi,

I have a custom Command  delete button, I wanted to disable this button.

I tried the below code, but its disable pagination hyperlink numbers also.

 $(".k-button").addClass("k-disabled");

 

 

Eyup
Telerik team
 answered on 28 Nov 2024
2 answers
52 views

(edit: I didn't initially realize this was being posted in the UI for jQuery forum and have since duplicated in the .net core forum - feel free to remove this one if deemed inappropriate for this forum)

I'm just starting to catalog the issues list, but I'm immediately noticing that any markup passed to non-template areas has ceased rendering.

For example:


<div class="demo-section">
    @(Html.Kendo().Switch()
                .Name("switch")
                .Messages(c => c.Checked("<span>YES</span>").Unchecked("<span>NO</span>"))
    )
</div>

used to render the markup vs displaying the markup text. Now it spits it out.

I have used similar techniques in Grid commands as well, which are all also broken. Basic custom commands I can work around by using the .Template option instead of .Text, but for an Edit's UpdateText and CancelText, I cannot find a workaround that isn't completely unbearable to manage at anything remotely near scale.

Is there a workaround or option to re-enable rendering HTML in these places I am simply not seeing? 

Also, this feels like a pretty significant change to bury inside of a generic "rendering mismatch" (which may not even be referring to this, but I cannot find anything in the breaking changes mentioning something like this change). If there's not an effective way to get back to this functionality, it's going to potentially cost me days/weeks to find a tenable solution.

Josh
Top achievements
Rank 1
Iron
 updated answer on 27 Nov 2024
1 answer
65 views

I have a Kendo grid and in the Create method, I want to do some server side validation and the response I want to show to the user if validation is true or false. 

In the below code CreateTLPCurveAllocations is an MVC action method which is having return type as void.

How to use the CreateTLPCurveAllocations  method with return type, so that I can show that return value/ message to the user.

@(Html.Kendo().Grid<TLPAllocationDetails>()

    .Name("TLPCurveAllocationsGrid")
    .DataSource(datasource => datasource.Ajax().Read(read => read.Action("GetTLPCurveAllocations", "DataMgmt")))
        .Columns(columns =>
        {
        columns.Bound(p => p.AllocationDate).Editable("EditFieldsForNewRec").Format("{0:MM/dd/yyyy}").Title("Allocation Date").Width(90).HeaderHtmlAttributes(new { style = "justify-content:center" }).HtmlAttributes(new { style = "text-align: right" });
        columns.Bound(p => p.CurveDetails).Editable("EditFieldsForNewRec").ClientTemplate("#=getCurveName(data)#").Title("Curve").Width(100).HeaderHtmlAttributes(new { style = "justify-content:center" }).HtmlAttributes(new { style = "text-align: right" });
        columns.Bound(p => p.Allocation).Editable("EditAllocation").Title("Allocation").Width(100).HeaderHtmlAttributes(new { style = "justify-content:center" }).HtmlAttributes(new { style = "text-align:right" });
        })
    .ToolBar(toolbar =>
    {
        toolbar.Create();
        toolbar.Save();                    
    })
    .HtmlAttributes(new { style = "height: 400px;width:97%" })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Navigatable()
    .Filterable()
    .Scrollable()
    .DataSource(dataSource => dataSource
    .Ajax()
    .Batch(true)
    .PageSize(5)
    .ServerOperation(false)
    .Model(model =>
    {
        model.Id(p => p.AllocationDate);
        model.Field(p => p.CurveDetails).DefaultValue(ViewData["CurveDetails"] as CurveDetails);
    })
    .Create("CreateTLPCurveAllocations", "DataMgmt")
    .Update("UpdateTLPCurveAllocations", "DataMgmt")
    )
    )

Ivan Danchev
Telerik team
 answered on 27 Nov 2024
1 answer
127 views

I am trying to upgrade a .NET 4.5 project using the Upgrade Wizard.  However, when I attempt to use the wizard I am getting a message saying "No distribution available for your project" and there aren't any versions listed in the dropdown.  

I downloaded the ASP.NET MCV 2024.4.1112.  Am I missing something?

I have attached a photo of the message I am receiving.

Maria
Telerik team
 answered on 26 Nov 2024
1 answer
28 views
I have a TileLayoutItems component on my page
For some reason nor button nor span would actually appear inside header of TileLayoutItem

    <TelerikTileLayout Columns="3"
                       ColumnWidth="285px"
                       RowHeight="285px"
                       Reorderable="true"
                       Resizable="true"
                       ColumnSpacing="0px"
                       RowSpacing="0px">
        <TileLayoutItems>
            <TileLayoutItem @ref="reference">
                <HeaderTemplate>
                    @* <button @onclick="OnCloseButtonClicked"></button> *@
                    <span>sometext</span>
                </HeaderTemplate>
                <Content>
                    <img class="k-card-image" draggable="false" src="images/cards/places/barcelona.jpg" alt="Barcelona" />
                </Content>
            </TileLayoutItem>
            <TileLayoutItem HeaderText="Sofia">
                <Content>
                    <img class="k-card-image" draggable="false" src="images/cards/places/sofia.jpg" alt="Sofia" />
                </Content>
            </TileLayoutItem>
            <TileLayoutItem HeaderText="Rome">
                <Content>
                    <img class="k-card-image" draggable="false" src="images/cards/places/rome.jpg" alt="Rome" />
                </Content>
            </TileLayoutItem>
        </TileLayoutItems>
    </TelerikTileLayout>

Eyup
Telerik team
 answered on 25 Nov 2024
1 answer
64 views

I need a support for ,

I am working on grid custom editing , i want to show success message after successful operation.

How can I do that ? Also If there is any way if we can use inbuild save changes button.

Below is my grid.

Thanks in advance.


            @(Html.Kendo().Grid<RVNLMIS.Models.ListMasterBOQResourceCalc>()
             .Name("ResourceTypeGrid")
             .Columns(columns =>
             {

                 // Resource Type column
                 columns.Bound(c => c.RsrcType)
                     .Title("Resource Type")
                     .ClientTemplate("#= RsrcType ? RsrcType.ResourceTypeName : '' #")
                     .EditorTemplateName("ClientResource")
                     .Sortable(false)
                     .HtmlAttributes(new { style = "text-align:left" })
                     .HeaderHtmlAttributes(new { style = "text-align:left" })
                     .Width(100)
                     ;

                 // Resource Name column
                 columns.Bound(c => c.drpResource)
                     .Title("Resource")
                     .ClientTemplate("#= drpResource ? drpResource.ResourceName : ''#")
                     .EditorTemplateName("ClientSubResources")
                     .Sortable(false)
                     .HtmlAttributes(new { style = "text-align:left" })
                     .HeaderHtmlAttributes(new { style = "text-align:left" })
                     .Width(170);

                 // Quantity column
                 columns.Bound(c => c.rsrcQty)
                     .Title("Quantity")
                     .HtmlAttributes(new { style = "text-align:right" })
                     .HeaderHtmlAttributes(new { style = "text-align:right" })
                     .Width(70)
                     .Format("{0:N2}");

                 // Wastage Percentage column
                 columns.Bound(c => c.wastagePct)
                     .Title("Wastage %")
                     .HtmlAttributes(new { style = "text-align:right" })
                     .HeaderHtmlAttributes(new { style = "text-align:right" })
                     .Width(60);

                 // Total Quantity column
                 columns.Bound(c => c.TotalQty)
                     .Title("Total Qty")
                     .HtmlAttributes(new { style = "text-align:right" })
                     .HeaderHtmlAttributes(new { style = "text-align:right" })
                     .Width(80)
                     .Format("{0:N2}");

                 // Unit column
                 columns.Bound(c => c.Unit)
                     .Title("Unit")
                     .HtmlAttributes(new { style = "text-align:left" })
                     .HeaderHtmlAttributes(new { style = "text-align:left" })
                     .Width(60);

                 // Base Rate column
                 columns.Bound(c => c.BaseRate)
                     .Title("Base Rate")
                     .HtmlAttributes(new { style = "text-align:right" })
                     .HeaderHtmlAttributes(new { style = "text-align:right" })
                     .Width(80)
                     .Format("{0:N2}");

                 // Total Rate column
                 columns.Bound(c => c.TotalRate)
                     .Title("Resource Amount")
                     .HtmlAttributes(new { style = "text-align:right" })
                     .HeaderHtmlAttributes(new { style = "text-align:right" })
                     .Width(100)
                     .Format("{0:N2}");
                 columns.Command(command => command.Destroy()).Width(80);
             })
             .ToolBar(t =>
             {
                 t.Template(@<text> <b class="ml-2"> Boq Resources Details </b>
                          @item.CreateButton()
                          @item.SaveButton()
                  </text>);
             })
             .Editable(editable => editable.Mode(GridEditMode.InCell))
             .Pageable() // Pagination enabled
             .Sortable() // Sorting enabled
             .Scrollable() // Scrollable grid
             .Events(e => e.Save("onGridSave"))
             .HtmlAttributes(new { style = "height:500px;" })
             .DataSource(dataSource => dataSource
                 .Ajax()
                 .Batch(true) // Batch editing
                 .ServerOperation(false) // Client-side operations
                 .Model(model =>
                 {
                     model.Id(p => p.AutoID); // Set primary key
                     model.Field(p => p.AutoID).Editable(false); // Disable editing for AutoID
                     model.Field(p => p.RsrcType).DefaultValue(
                                 ViewData["defaultResourceType"] as RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel);
                     model.Field(p => p.drpResource).DefaultValue(new RVNLMIS.Controllers.Sub_BOQController.DrpResourceModel
                     {
                         ResourceName = "Select Resource",
                         ResourceID = 0
                     });
                 })
                 .PageSize(20) // Set page size
                 .Read(read => read.Action("GetBOQResource_Details", "Sub_BOQ").Data("getBOQId"))
                 .Create(create => create.Action("EditingCustom_Create", "Sub_BOQ"))
                 .Update(update => update.Action("EditingCustom_Update", "Sub_BOQ"))
                 .Destroy(destroy => destroy.Action("EditingCustom_Destroy", "Sub_BOQ"))
             )
          )
Eyup
Telerik team
 answered on 22 Nov 2024
1 answer
27 views

  @(Html.Kendo().Grid<RVNLMIS.Models.ListMasterBOQResourceCalc>()
   .Name("ResourceTypeGrid")
   .Columns(columns =>
   {

       // Resource Type column
       columns.Bound(c => c.RsrcType)
           .Title("Resource Type")
           .ClientTemplate("#= RsrcType ? RsrcType.ResourceTypeName : '' #")
           .EditorTemplateName("ClientResource")
           .Sortable(false)
           .HtmlAttributes(new { style = "text-align:left" })
           .HeaderHtmlAttributes(new { style = "text-align:left" })
           .Width(120)
           ;

       // Resource Name column
       columns.Bound(c => c.drpResource)
           .Title("Resource")
           .ClientTemplate("#= drpResource ? drpResource.ResourceName : ''#")
           .EditorTemplateName("ClientSubResources")
           .Sortable(false)
           .HtmlAttributes(new { style = "text-align:left" })
           .HeaderHtmlAttributes(new { style = "text-align:left" })
           .Width(120);

       // Quantity column
       columns.Bound(c => c.rsrcQty)
           .Title("Quantity")
           .HtmlAttributes(new { style = "text-align:right" })
           .HeaderHtmlAttributes(new { style = "text-align:right" })
           .Width(70)
           .Format("{0:N2}");

       // Wastage Percentage column
       columns.Bound(c => c.wastagePct)
           .Title("Wastage %")
           .HtmlAttributes(new { style = "text-align:right" })
           .HeaderHtmlAttributes(new { style = "text-align:right" })
           .Width(60);

       // Total Quantity column
       columns.Bound(c => c.TotalQty)
           .Title("Total Qty")
           .HtmlAttributes(new { style = "text-align:right" })
           .HeaderHtmlAttributes(new { style = "text-align:right" })
           .Width(80)
           .Format("{0:N2}");

       // Unit column
       columns.Bound(c => c.Unit)
           .Title("Unit")
           .HtmlAttributes(new { style = "text-align:left" })
           .HeaderHtmlAttributes(new { style = "text-align:left" })
           .Width(60);

       // Base Rate column
       columns.Bound(c => c.BaseRate)
           .Title("Base Rate")
           .HtmlAttributes(new { style = "text-align:right" })
           .HeaderHtmlAttributes(new { style = "text-align:right" })
           .Width(80)
           .Format("{0:N2}");

       // Total Rate column
       columns.Bound(c => c.TotalRate)
           .Title("Resource Amount")
           .HtmlAttributes(new { style = "text-align:right" })
           .HeaderHtmlAttributes(new { style = "text-align:right" })
           .Width(100)
           .Format("{0:N2}");
       columns.Command(command => command.Destroy()).Width(150);
   })
   .ToolBar(t =>
   {
       t.Create().HtmlAttributes(new { style = "float:right; margin: 5px;" });
       t.Save().HtmlAttributes(new { style = "float:right; margin: 5px;" });
   })
   .Editable(editable => editable.Mode(GridEditMode.InCell))
   .Pageable() // Pagination enabled
   .Sortable() // Sorting enabled
   .Scrollable() // Scrollable grid
   .HtmlAttributes(new { style = "height:500px;" })
   .DataSource(dataSource => dataSource
       .Ajax()
       .Batch(true) // Batch editing
       .ServerOperation(false) // Client-side operations
       .Model(model =>
       {
           model.Id(p => p.AutoID); // Set primary key
           model.Field(p => p.AutoID).Editable(false); // Disable editing for AutoID
           model.Field(p => p.RsrcType).DefaultValue(
                       ViewData["defaultResourceType"] as RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel);
           model.Field(p => p.drpResource).DefaultValue(new RVNLMIS.Controllers.Sub_BOQController.DrpResourceModel
           {
               ResourceName = "Select Resource",
               ResourceID = 0
           });
       })
       .PageSize(20) // Set page size
       .Read(read => read.Action("GetBOQResource_Details", "Sub_BOQ").Data("getBOQId"))
       .Create(create => create.Action("EditingCustom_Create", "Sub_BOQ"))
       .Update(update => update.Action("EditingCustom_Update", "Sub_BOQ"))
       .Destroy(destroy => destroy.Action("EditingCustom_Destroy", "Sub_BOQ"))
   )
)

Above is grid code , the tool bar is not showing at the top of the grid .

It should show like below example.

 

Eyup
Telerik team
 answered on 22 Nov 2024
1 answer
43 views
public class ListMasterBOQResourceCalc
{
    public Nullable<int> BOQId { get; set; }
    public int AutoID { get; set; }
    public Nullable<int> RsrcTypeID { get; set; }
    public int raRsrcID { get; set; }
    public Nullable<decimal> rsrcQty { get; set; }
    public Nullable<decimal> wastagePct { get; set; }
    public Nullable<int> DisciplineID { get; set; }
    public string raRsrcName { get; set; }
    public string Unit { get; set; }
    public Nullable<decimal> BaseRate { get; set; }
    public string TotalQty { get; set; }
    public string TotalRate { get; set; }

    [Required]
    [UIHint("ClientResource")]
    public ResourceTypeModel RsrcType { get; set; }

    [Required]
    [UIHint("ClientSubResources")]
    public DrpResourceModel drpResource { get; set; }

}

 

@(Html.Kendo().Grid<RVNLMIS.Models.ListMasterBOQResourceCalc>()
        .Name("ResourceTypeGrid")
        .Columns(columns =>
        {

            // Resource Type column
            columns.Bound(c => c.RsrcType)
                .Title("Resource Type")
                .ClientTemplate("#= RsrcType ? RsrcType.ResourceTypeName : '' #")
                .EditorTemplateName("ClientResource")
                .Sortable(false)
                .HtmlAttributes(new { style = "text-align:left" })
                .HeaderHtmlAttributes(new { style = "text-align:left" })
                .Width(120)
                ;

            // Resource Name column
            columns.Bound(c => c.drpResource)
                .Title("Resource")
                .ClientTemplate("#= drpResource ? drpResource.ResourceName : ''#")
                .EditorTemplateName("ClientSubResources")
                .Sortable(false)
                .HtmlAttributes(new { style = "text-align:left" })
                .HeaderHtmlAttributes(new { style = "text-align:left" })
                .Width(120);

            // Quantity column
            columns.Bound(c => c.rsrcQty)
                .Title("Quantity")
                .HtmlAttributes(new { style = "text-align:right" })
                .HeaderHtmlAttributes(new { style = "text-align:right" })
                .Width(70)
                .Format("{0:N2}");

            // Wastage Percentage column
            columns.Bound(c => c.wastagePct)
                .Title("Wastage %")
                .HtmlAttributes(new { style = "text-align:right" })
                .HeaderHtmlAttributes(new { style = "text-align:right" })
                .Width(60);

            // Total Quantity column
            columns.Bound(c => c.TotalQty)
                .Title("Total Qty")
                .HtmlAttributes(new { style = "text-align:right" })
                .HeaderHtmlAttributes(new { style = "text-align:right" })
                .Width(80)
                .Format("{0:N2}");

            // Unit column
            columns.Bound(c => c.Unit)
                .Title("Unit")
                .HtmlAttributes(new { style = "text-align:left" })
                .HeaderHtmlAttributes(new { style = "text-align:left" })
                .Width(60);

            // Base Rate column
            columns.Bound(c => c.BaseRate)
                .Title("Base Rate")
                .HtmlAttributes(new { style = "text-align:right" })
                .HeaderHtmlAttributes(new { style = "text-align:right" })
                .Width(80)
                .Format("{0:N2}");

            // Total Rate column
            columns.Bound(c => c.TotalRate)
                .Title("Resource Amount")
                .HtmlAttributes(new { style = "text-align:right" })
                .HeaderHtmlAttributes(new { style = "text-align:right" })
                .Width(100)
                .Format("{0:N2}");
            columns.Command(command => command.Destroy()).Width(150);
        })
        .ToolBar(toolBar =>
        {
            toolBar.Create(); // Adds a Create button
            toolBar.Save();   // Adds a Save button
        })
        .Editable(editable => editable.Mode(GridEditMode.InCell))
        .Pageable() // Pagination enabled
        .Sortable() // Sorting enabled
        .Scrollable() // Scrollable grid
        .HtmlAttributes(new { style = "height:550px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true) // Batch editing
            .ServerOperation(false) // Client-side operations
            .Model(model =>
            {
                model.Id(p => p.AutoID); // Set primary key
                model.Field(p => p.AutoID).Editable(false); // Disable editing for AutoID
                model.Field(p => p.RsrcType).DefaultValue(
                            ViewData["defaultResourceType"] as RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel);
                model.Field(p => p.drpResource).DefaultValue(new RVNLMIS.Controllers.Sub_BOQController.DrpResourceModel
                {
                    ResourceName = "Select Resource",
                    ResourceID = 0
                });
            })
            .PageSize(20) // Set page size
            .Read(read => read.Action("GetBOQResource_Details", "Sub_BOQ").Data("getBOQId"))
            .Create(create => create.Action("EditingCustom_Create", "Sub_BOQ"))
            .Update(update => update.Action("EditingCustom_Update", "Sub_BOQ"))
            .Destroy(destroy => destroy.Action("EditingCustom_Destroy", "Sub_BOQ"))
        )
     )

ClientResource.cshtml

public class ResourceTypeModel
{
    public int ResourceTypeId { get; set; }
    public string ResourceTypeName { get; set; }
}

@model RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel

@(Html.Kendo().DropDownListFor(m => m)
    .Name("drpRsrcTypeId")
    .OptionLabel("Select Resource Type")
        .DataValueField("ResourceTypeId")
        .DataTextField("ResourceTypeName")
        .BindTo((IEnumerable<RVNLMIS.Controllers.Sub_BOQController.ResourceTypeModel>)ViewData["listResourceTypes"])
        .Events(e => e.Change("onResourceTypeChange"))
)

ClientSubResources.cshtml

public class DrpResourceModel
{
    public int ResourceID { get; set; }
    public string ResourceName { get; set; }
}

@model RVNLMIS.Controllers.Sub_BOQController.DrpResourceModel


@(Html.Kendo().DropDownListFor(m => m)
    .Name("drpRsrcId")
    .OptionLabel("Select Resource")
    .DataTextField("raRsrcName")
    .DataValueField("raRsrcID")
    .CascadeFrom("drpRsrcTypeId") // Cascade from the Category dropdown
    .DataSource(dataSource => dataSource
        .Read(read => read.Action("GetResourcesByTypeId", "Sub_BOQ").Data("getRsrcTypeID")) // Action to fetch subcategories
    )
    .Events(e => e.Change("onResourceChange"))
)

 

After selecting the values from dropdown , the values are not remain selected & also not passing to create method. The default values are passing to create method.

 

Eyup
Telerik team
 answered on 21 Nov 2024
1 answer
73 views

Hi,

I have a Kendo Menu with the menu items, when user will click on the menu it should show the Kendo panels vertically and then again click on the menu should hide the panels within that menu. On Click on the Panelbar items should show the respective pages.

Attached is the screenshot for the reference.

Eyup
Telerik team
 answered on 19 Nov 2024
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?