locked
css not working in partial view ...help ? RRS feed

  • Question

  • User240662514 posted

    I am using latest .Net core MVC.

    i have a main view. the main.cshtml view has css included as 

    <link rel="stylesheet" href="~/css/myStyle.css">

    within main view, i have set partial view as

    @Html.PartialAsync("Items", Model)   

    Now in my Items.cshtml view, i need to use that style css ....but seems like partial view just can't read the css as i am not seeing the css changes in UI.

    Any idea if am doing something wrong and how to fix it ?  

    Monday, February 3, 2020 8:55 AM

Answers

  • User-1780421697 posted

    Partial view is simply piece of code that extends usability, similar code repetition,  Try the partial view code directly in you Main.cshtml if it works fine then it means there is some issue with PartialView and if it is not working then there is issue with css.

    remember you friend (Browser developer tool - F12 key to invoke) it will let you know about your css available or not in browser. Another possible issue is browser cache , clear the cache especially in Chrome.otherwise will not see expected result.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 3, 2020 9:21 AM