Telerik Forums
UI for ASP.NET Core Forum
1 answer
185 views

Hi!

I have the following setup:

CsHtml:

	<div class="row mt-3">
		<div class="col-lg-4">
			@(Html.Kendo().DropDownListFor(m => m.CategoryHeadId)
			      .Size(ComponentSize.Medium)
				  .Rounded(Rounded.Medium)
				  .FillMode(FillMode.Solid)
				  .OptionLabel("Select head category...")
				  .HtmlAttributes(new { style = "width: 100%" })
				  .DataTextField("Name")
				  .DataValueField("Id")
				  .DataSource(source =>
				  {
					  source.Read(read =>
					  {
						  read.Action("GetLookupCategoriesHead", "Api");
					  });
				  })
				)
		</div>
		<div class="col-lg-4">
			@(Html.Kendo().DropDownListFor(m => m.CategoryMainId)
			      .Size(ComponentSize.Medium)
				.Rounded(Rounded.Medium)
				.FillMode(FillMode.Solid)
				.OptionLabel("Select main category...")
				.HtmlAttributes(new { style = "width: 100%" })
				.DataTextField("Name")
				.DataValueField("Id")
				.DataSource(source =>
				{
					source.Read(read =>
					{
						read.Action("GetLookupCategoriesMain", "Api")
						    .Data("filterMainCategories");
					})
					.ServerFiltering(true);
				})
				.Enable(false)
				.AutoBind(false)
				.CascadeFrom("CategoryHeadId")
				)
		</div>
		<div class="col-lg-4">
			@(Html.Kendo().DropDownListFor(m => m.CategorySubId)
				.Size(ComponentSize.Medium)
				.Rounded(Rounded.Medium)
				.FillMode(FillMode.Solid)
				.OptionLabel("Select sub-category...")
				.HtmlAttributes(new { style = "width: 100%" })
				.DataTextField("Name")
				.DataValueField("Id")
				.DataSource(source =>
				{
					source.Read(read =>
					{
						read.Action("GetLookupCategoriesSub", "Api")
						    .Data("filterSubCategories");
					})
					.ServerFiltering(true);
				})
				.Enable(false)
				.AutoBind(false)
				.CascadeFrom("CategoryMainId")
				)
		</div>
	</div>

Script:

@section Scripts {
	<script>
		function filterMainCategories() {
			return {
				headId: $("#CategoryHeadId").val()
			};
		}

		function filterSubCategories() {
			return {
				headId: $("#CategoryHeadId").val(),
				mainId: $("#CategoryMainId").val()
			};
		}
	</script>
}

Originally, this was a View on its own but later got refactored into an EditorTemplate. Since then, the second and third DropDowns are always disabled even if a parent makes a valid selection.

Console windows don't log any errors. I'm thinking it's an issue with the placement of the JS block. I tried placing it within a @Script section and directly. The thing that is really frustrating is that there are two views now using this EditorTemplate and one is working fine but the other has issues:

Create (Working):

	@using (Html.BeginForm("", "Letter", FormMethod.Post))
	{
		@Html.AntiForgeryToken()

		@Html.EditorFor(m => m, "Letter")

		<div class="row mt-3">
			<div class="col-md-1">
				<button type="submit" class="btn btn-primary w-100 me-5px" formaction="CreateSave" title="@(Model.IsUpdateCase ? "Update letter" : "Save letter")">@(Model.IsUpdateCase ? "Update" : "Save")</button>
			</div>
			<div class="col-md-1">
				<button type="submit" class="btn btn-default w-100" formaction="CreateSubmit" title="@(Model.IsUpdateCase ? "Update letter & submit" : "Save letter & submit")">Submit</button>
			</div>
		</div>
	}

ViewInfo (Not working):

	@using (Html.BeginForm("ViewInfo", "Letter", FormMethod.Post))
	{
		@Html.AntiForgeryToken()

		@Html.EditorFor(m => m.Letter, "Letter")

		<div class="row mt-3">
			<div class="col-md-1">
				<button type="submit" class="btn btn-primary w-100 me-5px" title="Submit">Submit</button>
			</div>
		</div>
	}

I have verified that the APIs are up and running and also the model for the template(s) is valid.

How do troubleshoot this behavior? And where should the script block files go per best practice? I think it should be in the template within the section.

DoomerDGR8
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 25 Jul 2022
1 answer
776 views
I have a switch that I would like to bind to a model, is this possible?     
Mihaela
Telerik team
 updated answer on 25 Jul 2022
1 answer
182 views

Hello

We use Telerik UI to ASP.NET Core to build the Razor Page app.

After connecting Hebrew Localization

    <script src="~/kendo/js/jquery.min.js" asp-append-version="true"></script>

    <script src="~/kendo/js/kendo.all.min.js" asp-append-version="true"></script>

    <script src="~/kendo/js/kendo.aspnetmvc.min.js" asp-append-version="true"></script>

    <script src="~/kendo/js/kendo.culture.he-IL.min.js" asp-append-version="true"></script>

    <script src="~/kendo/js/kendo.messages.he-IL.min.js" asp-append-version="true"></script>

    <script src="~/kendo/js/jszip.min.js" asp-append-version="true"></script>

    <script>kendo.culture("he-IL");</script>

 

 

 

We get the following picture

The script file kendo.messages.he-il.js contains the following overrides

 

  /* Grid messages */

 

    if (kendo.ui.Grid) {

        kendo.ui.Grid.prototype.options.messages =

            $.extend(true, kendo.ui.Grid.prototype.options.messages, {

                "commands": {

                    "cancel": "בטל",

                    "canceledit": "בטל עריכה",

                    "create": "צור חדש",

                    "destroy": "מחק",

                    "edit": "עריכה",

                    "save": "שמור",

                    "select": "בחר",

                    "update": "עדכן"

                },

                "editable": {

                    "cancelDelete": "בטל מחיקה",

                    "confirmation": "האם הנך בטוח שברונך לבצע זאת?",

                    "confirmDelete": "אשר מחיקה"

                }

            });

    }

 

    /* Pager messages */

 

    if (kendo.ui.Pager) {

        kendo.ui.Pager.prototype.options.messages =

            $.extend(true, kendo.ui.Pager.prototype.options.messages, {

                "allPages": "All",

                "page": "עמוד",

                "display": "{0} - {1} מתוך {2} פריטים",

                "of": "מתוך {0}",

                "empty": "אין פריטים להצגה",

                "refresh": "רענן",

                "first": "לעמוד הראשון",

                "itemsPerPage": "פריטים בעמוד",

                "last": "לעמוד האחרון",

                "next": "לעמוד הבא",

                "previous": "לעמוד הקודם",

                "morePages": "עמודים נוספים"

            });

    } 

 

What we need to do to get localization at least within what is in the script?

 

Best regards

 

Mihaela
Telerik team
 answered on 21 Jul 2022
1 answer
303 views

Hi!

Why is it so difficult to have the gid set itself to 100% of the height of the container it is in? All the guides I see here are just trial and error attempts.

Here is my CSS hierarchy:

GridFullHeight.png

I need my grid to be using all available height of the container. Currently, the main grid is only taking half of the screen (450px, set internally by Kendo) and expanding the details template with a tab strip and a child grid, the look and feel just doesn't look or feel right. The child grid doesn't need to have extra length. In fact, it should do the reverse: max height just enough to show all rows and not a pixel more. How do I set this up?

Mihaela
Telerik team
 answered on 21 Jul 2022
1 answer
163 views

Hello,

Is there a way to add comments in ASP.NET Core Editor just like how you are able to on ASP.NET AJAX.

I see that I am able to use Telerik Document Processing to open a docx file and  add comments on there, but I want to be able to do that on the Editor.

 

Thank you,

Mihaela
Telerik team
 answered on 18 Jul 2022
1 answer
194 views

Hi There

I have a Grid that placed in a boostrap modal.

In this grid, there is an in cell edit column with a DropDownList as client template.

The DropDownList is not displayed, only the input box and the data is shown when enter edit mode of the cell.

No problem when placing the grid on the main body, outside the modal.

Can anyone help on how I can have the dropdownlist shown ? thanks in advance.

Alexander
Telerik team
 answered on 18 Jul 2022
5 answers
3.3K+ views

Scenario - Asp.net Core, Razor Pages     

If i have no Controller (using razor pages), is there a way to bind a column to a clientTemplate that contain some sort of Action Link or Navigation link?

I need this so a user can simple click on a link on a row in the grid whicj then does the usual "Edit, Details, Delete"

 

If i was to not have telerik grid and just us a table it would look like this:

 <td>
                <a asp-page="./Edit" asp-route-id="@item.Id">Edit</a> |
                <a asp-page="./Details" asp-route-id="@item.Id">Details</a> |
                <a asp-page="./Delete" asp-route-id="@item.Id">Delete</a>
            </td>
        </tr>
}
    </tbody>
</table>

 

Stefan
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 15 Jul 2022
1 answer
219 views

Hi!

I have this scenario where I want to forward the current model's sub-object as a model to a DisplayTemplate within the Grid's ClientDetailTemplate: Checkout the first Tab of the TabStrip in the ClientDetailTemplate

Main View:

@(Html.Kendo().Grid(Model)
      .Name("gridLetters")
      .Columns(columns =>
      {
	      columns.Bound(p => p.Id).ClientTemplate("<a href='" + Url.Action("View", "Letter", new { letterId = "#:Id#" }) + "'>#=Id#</i></a>");
	      columns.Bound(p => p.Subject);
	      columns.Bound(p => p.CompanyName).Title("Company");
	      columns.Bound(p => p.BrandName).Title("Brand");
	      columns.Bound(p => p.Location.Name).Title("Location");
	      columns.Bound(p => p.LetterType.Name).Title("RL Type");	      
      })
      .ToolBar(toolbar =>
      {
	      toolbar.Search();
      })
      .Sortable()
      .Navigatable()
      .Resizable(r => r.Columns(true))
      .Pageable(pageable => pageable
	                .Refresh(true)
	                .PageSizes(true)
	                .ButtonCount(5))
      .Filterable()
      .Scrollable()
      .ClientDetailTemplateId("detailTemplate")
      .HtmlAttributes(new { style = "height:430px;" })
      .DataSource(dataSource => dataSource
	                  .Ajax()
	                  .Sort(x => x.Add("Id").Descending())
	                  .PageSize(20)
	                  .ServerOperation(false)
	  ))

@section Scripts {
	<script id="detailTemplate" type="text/kendo-tmpl">
	    @(Html.Kendo().TabStrip()
	          .Name("tabStrip_#=Id#")
	          .SelectedIndex(0)
	          .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
	          .Items(items =>
	          {
		          items.Add().Text("History").Content(@<text>@Html.DisplayFor(m => m.History, "LetterHistory")</text>);
		          items.Add().Text("Details").Content("");
	          }).ToClientTemplate())
	</script>
}

Above, the model for the main grid is an IList of my objects. Each object has a History property of type

BusApp.Domain.Models.BusinessObjects.LetterActionHistoryFlatModel

I need to get that property passed on as a model for the DisplayFor

LetterHistory.cshtml

@model IList<BusApp.Domain.Models.BusinessObjects.LetterActionHistoryFlatModel>

@(Html.Kendo().Grid(Model)
      .Name("gridLetterHistory")
      .Columns(columns =>
      {
	      columns.Bound(p => p.ActionStamp).Title("Stamp").Format("{0:dd-MMM-yyyy}");
	      columns.Bound(p => p.LetterActionName).Title("Action");
	      columns.Bound(p => p.ActionTakenByName).Title("Taken By");
      })
      .Navigatable()
      .Resizable(r=>r.Columns(true))
      .Pageable(pageable => pageable
	                .Refresh(true)
	                .PageSizes(true)
	                .ButtonCount(10))
      .Filterable()
      .Scrollable()
      .DataSource(dataSource => dataSource
	                  .Ajax()
	                  .Sort(x => x.Add("ActionStamp").Descending())
	                  .PageSize(20)
	                  .ServerOperation(false)
	  )
	)

Regrds.

Mihaela
Telerik team
 answered on 14 Jul 2022
1 answer
270 views

The aspnet core binaries looked like this with the previous release. See below.

Now, it appears the net6.0 is gone.Why go backwards to netstandard2.0? Where was this explained? I feel like upgrading is a huge downgrade so I should NOT do it.

We were told this 2 years ago - https://visualstudiomagazine.com/articles/2020/09/16/net-standard-future.aspx .

Stoyan
Telerik team
 answered on 11 Jul 2022
1 answer
241 views

hello, 
what is the general pattern to include a grid inside another Grid's DetailTemplate? I have a heriarchical collections I need to populate. I don't see other way than declaring a script inside the template's script tag, but that is invalid html.

Momchil
Telerik team
 answered on 08 Jul 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?