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

I've tried several iterations, and something isn't right. If I type the endpoint in a browser, I get a Json result. Swagger shows the API returning stuff. No luck with the DropDownList yet.

Here is my current markup on the client:


    <div>
        <kendo-datasource name="data" type="DataSourceTagHelperType.WebApi" server-operation="true">
            <transport>
                <read url="https://localhost:7225/api/SievePack" action="get" datatype="jsonp"/>
            </transport>
            <schema>
                <model id="SieveSetId">
                    <fields>
                        <field name="SieveSetId" type="number" />
                        <field name="SieveSetName" type="number" />
                    </fields>
                </model>
            </schema>
        </kendo-datasource>

        <script>
            data.read();
        </script>
        
        <kendo-dropdownlist name="sets"
                            datatextfield="SieveSetName"
                            datavaluefield="SieveSetId"
                            datasource="data">
        </kendo-dropdownlist>

    </div>

I have the API solution running when I launch the client.

Do I need to do something in another part of my application? From what I've been reading, this should work..

Thanks!

Mihaela
Telerik team
 answered on 19 Sep 2022
1 answer
1.1K+ views

Hi, I have a Kendo Dropdownlist with ajax datasource, ServerFiltering and a contains filter.

Unfortunately, the contains filter does not work. I tried to pass the "text" parameter in the data-function of the dropdownlist, but without success.

<select id="multiselect" multiple="multiple"></select> $("#multiselect").kendoDropDownList({ name: "dataSelect", filter: "contains", dataSource: { type: "aspnetmvc-ajax", serverFiltering: true, transport: { read: { type: "POST", url: "@Url.Page("Data", "ReadData")", data: function() {

//var text = $('#dataSelect').data("kendoDropDownList").filterInput; not working

//var data = { text: text };
                    //return $.extend(kendo.antiForgeryTokens(), data);

return kendo.antiForgeryTokens(); } } } });

public ActionResult OnPostReadData([DataSourceRequest] DataSourceRequest request, string text)
{

}


Aleksandar
Telerik team
 answered on 19 Sep 2022
1 answer
126 views

Hi,

As per the Github issue here, when the DropDownTree has Checkboxes enabled, is there a way to post its selected values to a controller, either as comma-separated IDs or an array?

I would have expected this to work in a similar way to the MultiSelect control, but unless I'm missing something that doesn't appear to be the case.

Many thanks in advance,

David.

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 16 Sep 2022
1 answer
826 views

Hi,

I have a question for you:
I would like to create a filter for one column of my Grid. The values of this column are integers, but the values are not visible for the users. They see only an icon depending on the value's range. (see the linked image)

 

For example:
If the value is 89, the user sees an icon and the tooltip for that is "Very good".

We have 4 ranges:
0-50 Bad,

51-70 OK,

71-85 Good,

86-100 Very good

How can I create a filter, where only the 4 text can be selected from a dropdown, but is filters for the range represented by the text?

Thanks in advance.

Aleksandar
Telerik team
 answered on 15 Sep 2022
1 answer
151 views

We are using the .net Core scheduler and i have 6x appointments on a day ranging from 10 min to 1 hour; A,B,C,D,E,F.

I want to move appointments around using drag and drop eg Change C, before B, and A after D, etc. 

I want to show a cursor so I can tell that when I drop the appointment C it will in fact insert between A and B. I do not want them in parallel.

I also want the schedule to adjust based on the changed times as I move the appointments. 

This should be a simple and intuitive process of 1 click, drag, and drop, not involving creating holes, filling them, rearranging appointments etc etc..

Aleksandar
Telerik team
 answered on 14 Sep 2022
1 answer
933 views

In my application I have used 

ModelState.AddModelError("Fieldid", "ErrorMessage");

first time on button click it is validating fine, 

from second time(without refreshing the page) I give another wrong input and it still validate but error message on UI didn't show.

tried debugging the code didn't found any issue,

tried to see console on web browser , no error shows.

Alexander
Telerik team
 answered on 12 Sep 2022
1 answer
150 views

Howdy!

I have a scenario in which I need to run some code when the item selected in a foreign key column in my grid is changed when it is being edited.

I can access other columns' editors without issue, but for some reason, every time I attempt to grab the editor for the foreign key column, it comes up as null.

For instance, I can use the following to grab the numeric text box for the edited row (in the Grid's on-edit event) with no issues:

var mcEditor = e.container.find("input[name=MoistureContent]").data("kendoNumericTextBox");

But, the only thing I can get to return as an object in the same on-edit event of the grid is the following:

var proctorEditor = e.container.find("input[name=ProctorReportId]");

I've tried using the following with no luck:

var proctorEditor = e.container.find("input[name=ProctorReportId]").data("kendoDropDownList");
var proctorEditor = e.container.find("input[name=ProctorReportId]").data("kendoComboBox");
The two instances above return null objects. But, as I mentioned, everything up until the call to .data() works. I'm at a loss of what the correct value to pass to the data() method should be to return the editor for the foreign key column in the grid.
Travis
Top achievements
Rank 1
Iron
 answered on 11 Sep 2022
1 answer
219 views

We are using a GridColumnSettings for a grid view.

Because the data is text heavy, we are using a popup when editing it.

This puts the Save and Cancel buttons at the bottom of form.  We have a user who doesn't want to scroll down to Save. (We already have had to put Save at the top of another form with links to Top.)

Is there any way to force the buttons to appear at the top or in both places? Any suggestions welcome. 

These are the basic settings we are using:

on the grid page:

 @(Html.Kendo().Grid<TITLE_PATTERN_1>().Name("grid")
        .Sortable()
        .Editable(x => x.Mode(GridEditMode.PopUp).TemplateName("TITLEPATTERNEditor").Window(w => w.Width(700)))
        .Scrollable()
        .Filterable()
        .Resizable(r => r.Columns(true))
        .ToolBar(tools => tools.Excel().IconClass("k-icon k-i-download"))
        .Excel(excel => excel
        .FileName("TitlePatterns.xlsx")
        .Filterable(true)
        .AllPages(true)
        .ProxyURL("TitlePattern?handler=Save")
        )
          .Columns(columns => columns.LoadSettings(Model.columns)
   )
        .DataSource(ds => ds.Ajax().Events(events => events.Error("error_handler"))
        .Events(events => events.Error("error_handler"))
        .Read(r => r.Url(Url.Action() + "?handler=Read").Data("forgeryToken"))
        .Update(u => u.Url(Url.Action() + "?handler=UpdatePopUp").Data("forgeryToken"))
        .Destroy(d => d.Url(Url.Action() + "?handler=Destroy").Data("forgeryToken"))
        .Model(m =>
        {
            m.Id(id => id.Id);
            m.Field(p => p.Id).Editable(false);

        })
        .PageSize(50)
        )
        .Pageable()

          )

In the GridColumnSettings

 new GridCommandColumnSettings
            {
                Commands =
                {
                     new GridEditActionCommand()
                     {  
                         Name = "Update",
                         Text = "Update",
                         UpdateText = "Save",                         
                         CancelText = "Cancel"                         
                     },

                 },
                Width = "100px",
                Filterable = false,
                Locked = true,
                Title = "Update"
               },

And this is the template:

@Html.HiddenFor(model => model.Id)

    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.TITLE_CODE)
    </div>
    <div class="k-textbox" style="padding: 10px;">
        @Html.EditorFor(model => model.TITLE_CODE)
        @Html.ValidationMessageFor(model => model.TITLE_CODE)
    </div>

    <div class="k-edit-label"  style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD1)
    </div>
    <div class="k-textarea"  style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD1).Rows(5)
    </div>

    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD2)
    </div>

    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD2).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD3)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD3).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD4)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD4).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD5)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD5).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD7)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD7).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.FIELD8)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.FIELD8).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE1)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE1).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE2)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE2).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE3)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE3).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE4)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE4).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE5)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE5).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE6)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE6).Rows(5)
    </div> <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE7)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE7).Rows(5)
    </div>
    <div class="k-edit-label" style="padding: 10px;">
        @Html.LabelFor(model => model.NOTE8)
    </div>
    <div class="k-textarea" style="padding: 10px;">
        @Html.Kendo().TextAreaFor(model => model.NOTE8).Rows(5)
    </div>

 

                   
Mihaela
Telerik team
 answered on 09 Sep 2022
1 answer
241 views

Howdy

I am opening a window to display a razor page using the following


function dblClickCalEvent(e) {

		var win = $("#scheduleWindow").data("kendoWindow");

		win.refresh({
			url: "@Url.Page("ScheduleForm", "Details")",
			data: { clickDate: e.dataset.clickdate, scheduleId: e.dataset.scheduleid }
		});
		win.center().open();

	}

This opens the Razor page and calls the OnGetDetails and renders the page using the correct Model.  I have a MultiSelect on the page using the Select Event which once a value is selected POSTs back to the page using the following:




	function attendee_selected(e) {


		$.ajax({
			type: "POST",
			url: "ScheduleForm?handler=AttendAdd",
			data: { __RequestVerificationToken: '@token', attendee: e.dataItem.UserPrincipleName }
		});


	}

Which posts to this:


public async Task<IActionResult> OnPostAttendAdd(string attendee)

And returns Page();

I can see that the model gets populated while debugging the Razor page, however the page never renders the new results on page.  I have tried to call a refresh on the window but this has no effect.  Here is and example of where the ViewDates change once the Page is returned from the Post method and the changes are not reflected in the page in the window:


<table style="width: 100%;">
				<tr>
					@foreach (var d in Model.ScheduleAssistaint.ViewDates)
					{

						<td class="border1" style="text-align:center;">
							@d.ToLongDateString()
						</td>

					}
				</tr>
			</table>

Is this something to do with the fact the page is inside a window?  If so is there a way to fix this?

 

Thanks

Alexander
Telerik team
 answered on 09 Sep 2022
3 answers
308 views

I'm using the Drawer TagHelper and when the page opens, I'd like the Drawer to start open if the user cookie is set to open and closed if the cookie is set to closed. I am doing this currently using javascript but it causes it to open every time you go to a new page. Is there a setting on the taghelper that will cause it to start out open or closed rather than having to set it using javascript?

Thanks!

Laurie

Here's my code:

                <kendo-drawer name="drawer" mode="push" on-hide="onHide" min position="left" swipe-to-open="false" template-id="template" class="no-border">
                    <mini enabled="true" />
                </kendo-drawer>
<script>
            $(document).ready(function () {
               var drawerInstance = $("#drawer").data().kendoDrawer;
                var hideMenu = getCookie("HideCustomerMenu");                  
                if (hideMenu == 'true') {
                    var arrowButton = $("#expand");
                    arrowButton.toggleClass('flip');
                    drawerInstance.hide();
                }
                else {                  
                    drawerInstance.show();
                }
 
            });
</script
        <script id="template" type="text/x-kendo-template">
            <ul class="menuBar list-unstyled">
                       <li id="customerinfo"><a href="/customer" ><i class="fa fa-user-circle fa-2x fa-fw mr-2" aria-hidden="true" title="Customer Information"></i>Customer Info</a></li>
                       <li id="test"><a href="/test" ><i class="fa fa-user-circle fa-2x fa-fw mr-2" aria-hidden="true" title="Test"></i>Test</a></li>
            </ul>
        </script>
Stoyan
Telerik team
 updated answer on 08 Sep 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?