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

Hi!

I have tried following the Asynchronous upload documentation, but whenever I try to upload file(s), it always fails and the server responded with a status of 404.

Thanks in advance for your help.

My code is as follows:

HTML:

<div>
    @(Html.Kendo().Upload()
        .Name("files")
        .Async(a => a
            .Save("SaveAsync", "Home")
            .Remove("RemoveAsync", "Home")
            .AutoUpload(true)
        )
    )
</div>

Controller:

public class HomeController : Controller
    {
        private IWebHostEnvironment _WebHostEnvironment;
        
        public HomeController(IWebHostEnvironment webHostEnvironment)
        {
            _WebHostEnvironment = webHostEnvironment;
        }

        public async Task<ActionResult> SaveAsync(IEnumerable<IFormFile> files)
        {
            // The Name of the Upload component is "files".
            if (files != null)
            {
                foreach (var file in files)
                {
                    var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition);

                    // Some browsers send file names with full path.
                    // We are only interested in the file name.
                    var fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
                    var physicalPath = Path.Combine(_WebHostEnvironment.WebRootPath, "App_Data", fileName);

                    using (var fileStream = new FileStream(physicalPath, FileMode.Create))
                    {
                        await file.CopyToAsync(fileStream);
                    }
                }
            }

            // Return an empty string to signify success.
            return Content("");
        }

        public ActionResult RemoveAsync(string[] fileNames)
        {
            // The parameter of the Remove action must be called "fileNames".

            if (fileNames != null)
            {
                foreach (var fullName in fileNames)
                {
                    var fileName = Path.GetFileName(fullName);
                    var physicalPath = Path.Combine(_WebHostEnvironment.WebRootPath, "App_Data", fileName);

                    // TODO: Verify user permissions.

                    if (System.IO.File.Exists(physicalPath))
                    {
                        System.IO.File.Delete(physicalPath);
                    }
                }
            }

            // Return an empty string to signify success.
            return Content("");
        }

        
    }

 

Tsvetomir
Telerik team
 answered on 06 Jul 2021
1 answer
358 views

Greetings,

Is it possible to drag items from another control such as a list and drop them on the TaskBoard similar to how you can drag items from the grid control and drop them on a calendar? Very interested in this functionality.

Thanks,

Scott

Tsvetomir
Telerik team
 answered on 06 Jul 2021
1 answer
236 views

Hello,

I create a ListBox that I bind to a list of SelectListItem. In this list i use the Group property. But i don't know how to render groups in Html.Kendo().ListBox()

I'm using mvc core and Telerik.UI.for.ASP.Net.Core version 2021.2.511 package

 

Regards

 

Tsvetomir
Telerik team
 answered on 05 Jul 2021
1 answer
1.9K+ views

I have a grid and I'm doing inline editing. I have a property in my model that is an enum. Using the Display() attribute on the enum works great for rendering the grid. But when I go to edit a row I have not been able to get a dropdownlist with the enum values to display.

I have a partial view in the EditorTemplates for the enum.

@model Dashboard.Web.Models.Schedule

@(Html.Kendo().DropDownListFor(m => m.GotoType)       
        .DataTextField("Text")
        .DataValueField("Value")
        .BindTo(Html.GetEnumSelectList(typeof(Dashboard.Web.Models.GotoType)))
        .Deferred()
    )

My model  I have the UIHint attrbute on the enum property.

public class Schedule
{
        [Key]
        public int Id { get; set; }
     
        [Display(Name = "Go To ")]
        [UIHint("GotoTypeEditor")]
        public GotoType GotoType { get; set; }

        [ForeignKey("Location"), Display(Name = "Location")]
        public int LocationId { get; set; }
        public Location Location {get; set;}
}

What do I need to do in the Kendo.Grid? I tried adding the EditorTemplateName this did not work. Do i need to do something in the datasource.Model definition?

 

Jay
Top achievements
Rank 1
Iron
Iron
 answered on 02 Jul 2021
1 answer
3.1K+ views

 

Uncaught TypeError: jQuery(...).kendoTextBox is not a function

 

I found this same question on SO here

https://stackoverflow.com/questions/62596574/asp-net-core-kendo-ui-textboxfor-fails-to-load

 

We (our team) tried the proposed solution, but we still get the error.

 

We are using ASP.NET Core, Telerik UI

Aleksandar
Telerik team
 answered on 02 Jul 2021
1 answer
1.0K+ views

I have a dashboard page that will be displayed on a larger flat screen TV. I don't what the menu bar showing just the hamburger button on the nav bar. How would I do this for a large screen format. I'm not sure what to change on the kendo-responsivepanel

How do I configure the button to be visible and the responsive-panel to be hidden by default?

 <button id="configure" class="k-rpanel-toggle k-button k-primary btn-toggle">
                <span class="k-icon k-i-menu"></span>
 </button>

....

 <div id="responsive-panel" class="navbar navbar-dark navbar-collapse bg-light mb-4">
        <kendo-responsivepanel name="responsive-panel" auto-close="false" breakpoint="758" orientation="top">
            @(Html.Kendo().Menu()
                        .Name("Menu")
                        .Items(items =>
                        {                          
                            items.Add().Text("Schedule").Action("Index", "Schedule", new { area = "" });
                            items.Add().Text("Locations")
                                .Items(ddl =>
                                {
                                    ddl.Add().Text("Brownwood").Action("Index", "Home", new { locationCode = "BW" });
                                   . . . 
                                });
                        })
            )
           
        </kendo-responsivepanel>
    </div>




Jay
Top achievements
Rank 1
Iron
Iron
 answered on 01 Jul 2021
1 answer
192 views
I'm creating a dashboard app and I have a listview to retrieve some data. I want to re-fetch the data ever 10 minutes. Do I use javascript setInterval()  or do you have some built in function on your datasource to do this? I assume Telerik would do this on most of your gauges and charts components.

Aleksandar
Telerik team
 answered on 01 Jul 2021
0 answers
266 views

I am a software engineer supporting a legacy product which uses Telerik 2018.2.516.45 . We are using Telerik for ASP.NET Core . 

We have a Telerik  Radwindow embedded into an .aspx page which we intend to use as a modal dialog box thus:

 

< telerik : RadWindow runat="server" ID="rwE1Products"  DockMode="false"  VisibleOnPageLoad="false" AutoSize="true" OnClientBeforeShow="onPopupShow" OnClientClose="onPopupHide" ClientIDMode="Static">


    <ContentTemplate>
        <div class="info_popup">
            <Repeater runat="server" ItemType="System.Tuple`2[System.String,System.String]" ID="rptData">
                <HeaderTemplate>
                    <ul>
                </HeaderTemplate>
                <ItemTemplate>

<!-- some content -->

                </ItemTemplate>
                <FooterTemplate>
                    </ul>
                </FooterTemplate>
                <EmptyTemplate>
                </EmptyTemplate>
            </Repeater>
        </div>
    </ContentTemplate>
</telerik:RadWindow>

 

And on this page, we call it thus:

    function showE1Product() {
        var oWnd = $find('rwE1Products');
        oWnd.show();
        $('#RadWindowWrapper_rwE1Products').css({ 'z-index': '10007' });
        $('#rwE1Products_C').css({ 'overflow': 'hidden' });
    }

Which is called with a button click.

When we click the button, the modal appears blank and the screen is moreover locked.  Looking in our chrome developer tools, we see the error:

Uncaught TypeError: Cannot read property 'style' of undefined
    at c.RadWindow.setOverflowVisible (ScriptResource.axd?d=wl5RKBCXTWDacHhxsSq8Q5gVEhb1VTyApq4eHCb1LIATB-dfkUbfjZqwHAMAcwKstvsADD5CfrfCrz5tBRnf1RC2Ji982n8TmXGh3FF4LqbYvZEtKgOV2F48baIXy3BkdwUasQ2&t=2afde251:851)
    at c.RadWindow.autoSize (ScriptResource.axd?d=wl5RKBCXTWDacHhxsSq8Q5gVEhb1VTyApq4eHCb1LIATB-dfkUbfjZqwHAMAcwKstvsADD5CfrfCrz5tBRnf1RC2Ji982n8TmXGh3FF4LqbYvZEtKgOV2F48baIXy3BkdwUasQ2&t=2afde251:641)
    at c.RadWindow._afterShow (ScriptResource.axd?d=wl5RKBCXTWDacHhxsSq8Q5gVEhb1VTyApq4eHCb1LIATB-dfkUbfjZqwHAMAcwKstvsADD5CfrfCrz5tBRnf1RC2Ji982n8TmXGh3FF4LqbYvZEtKgOV2F48baIXy3BkdwUasQ2&t=2afde251:488)
    at c.RadWindow.show (ScriptResource.axd?d=wl5RKBCXTWDacHhxsSq8Q5gVEhb1VTyApq4eHCb1LIATB-dfkUbfjZqwHAMAcwKstvsADD5CfrfCrz5tBRnf1RC2Ji982n8TmXGh3FF4LqbYvZEtKgOV2F48baIXy3BkdwUasQ2&t=2afde251:439)
    at showE1Product ()
    at HTMLAnchorElement.onclick ()

 

Drilling down into the radwindow card, within the radwindow javascript, i see the problem here:

if(this._dockMode){this.get_contentElement().style

get_contentElement() is returning null. And the reason it is returning null is because this.pending_ui is also null.  

I have been googling, asking colleagues, and scanning these forums without finding any idea as to how to solve the issue. I removed the "ClientIDMode=Static" field without result.

I see that this call is set only when dockmode is nonzero. Is there a way to null that out and bypass the issue? If not, why would pending_ui be null?   

This is well down into the guts of the radwindow implementation at this point, so I thought it worthwhile to ask for advice at this juncture.

One final clue is that this was apparently working up until about April of this year, but we're seeing the same problem on IE 11 , which hasn't been updated in forever,  so I don't think the issue is due to a browser change. 

 

UPDATE:

The javascript methods on the clientshow and clienthide hooks are

    function onPopupShow(sender, args) {
        $('#updateProgressDiv').show();
    }
    function onPopupHide(sender, args) {
        $('#updateProgressDiv').hide();
    }

which is apparently another div on the page.   

Removing these hooks allows the dialog to display without locking the screen. However, we still do not see the content.

UPDATE 2: Modifying the "open window" javascript to use a manager thus: 

    function showE1Product() {
        var manager = GetRadWindowManager(); 
        manager.open(null, 'rwE1Products');
/*        var oWnd = $find('rwE1Products');
        oWnd.show(); */
        $('#RadWindowWrapper_rwE1Products').css({ 'z-index': '10007' });
        $('#rwE1Products_C').css({ 'overflow': 'hidden' });
    }

Gets rid of the console errors, but the content is still not populated.

Still, we seem to have answered at least one of the problems: We were getting the errors because we weren't using a radwindowmanager when one was available.

UPDATE #3 :

Solved the problem.  Removed the clientidmode=static and changed the open method to

    function showE1Product() {
        var oWnd = $find('<%= rwE1Products.ClientID %>');
        oWnd.show();
        $('#RadWindowWrapper_<%= rwE1Products.ClientID%>').css({ 'z-index': '10007' });
        $('#<%= rwE1Products.ClientID%>_C').css({ 'overflow': 'hidden' });
    }

Apparently radwindow doesn't like static ids.  If anyone would like to shed some light on why this would be and how we can use them PROPERLY, I'd love to read it.  But the issue itself is solved.

UPDATE #4: Now that I know what to look for, I find out that you just can't use static ids with a telerik control.

https://www.telerik.com/forums/changing-window-clientidmode-to-static-causes-javascript-error

So the problem was the static id, and there is no way to use one; we must use default client id mode. This question is answered. 

Respectfully,

 

Brian P.

 

 

 

 

 

 

 

Brian
Top achievements
Rank 1
 updated question on 30 Jun 2021
1 answer
434 views

Hi am trying to add the kendo textbox in my custom Tag helper. I am not able to do it.

 

  public string Title { get; set; }
        public  override void Process(TagHelperContext context, TagHelperOutput output)
        {
            string htmlContent = $@"<div class=text-left>
                <div class=row col-12>
                    <div class=col-6>
                        <label >Name</label>
                    </div>
                    <div class=col-6>
             <kendo-textbox name=Name placeholder=Name ></kendo-textbox>
                  </div>
                </div>
                <div class=dropdown-divider></div>
            </div>";



            output.TagName = "div";
            output.Content.SetHtmlContent(htmlContent);
            output.TagMode = TagMode.StartTagAndEndTag;
        }
Tsvetomir
Telerik team
 answered on 30 Jun 2021
1 answer
256 views

When I export the grouped grid to by columns in pdf, in pdf the groupings that have a lot of data split and generate several equal smaller groupings, when the right thing would be that the groupings remain independent of the amount of data.

 

Tsvetomir
Telerik team
 answered on 29 Jun 2021
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?