.cshtml File Not Refreshing - asp.net

I have a file named _RelatedProductsPartial.cshtml located in an MVC project in the Views/Shared folder that is used as a partial view inside a products page to render a carousel of potentially related products. The related products show up as expected, but the URLs are incorrect. I made a backup of the file and tried editing the file to fix how the URLs are being dynamically generated and saved the file and tried again, but my changes were not reflected as the URLs are still in the original format. I even tried just editing some text and retesting and that change was not reflected either. My question is, do parital/Shared views actually need to be compiled into the relevant DLL? Is that why I am not seeing the changes reflected? I am new to Asp.net so I hope there is a simple solution to this issue. Thanks.

Related

Css file doesn't affect after editing in SharePoint Online

I has a css file named styles.css and it was loaded in masterPage of sharepoint .I change this css file but not working. I make sure this css file already loaded in html page.I also clear cache but I don't know why it doesn't affect when I edit. Please help me, thank you so much!
It is not recommended to modify the online master page directly.
Firstly, you need to check if the CSS file is really imported.
Secondly,if the file is not imported, classic page you could upload CSS here.
modern page we should upload CSS with SPFX,here is a tutorial: https://github.com/hugoabernier/react-application-injectcss.
If the file is imported, first check whether the content of the file is displayed normally (excluding problems caused by encoding), then you can add ‘! Important’ after the style.

Organizing blogdown/Hugo structure properly for automatic update of content

A detailed question about organizing content for blogdown/Hugo properly.
Built two websites with blogdown/Hugo, deployed via Netlify. One is simple and is easy to update, the second starts to become a mess because of my failure to organize content properly.
Basically, as I understand, we have two main folders /content and /public.
I am developing everything in /content.
The current structure of /content looks like this.
Any folder in /content like /content/team or /content/post has the same structure:
rmd files
html files
/img folder, where I store images
Example:
The problem starts at /public folder, it became a mess.
In my more simple web-site everything updates automatically as soon as I save my work and do blogdown::serve_site(). Here it is not.
For example, the same /team folder became a mess and looks like this.
Here I have .html index file, some other folders, which I did not create. I created public/team/images though, trying to understand where to locate the file.
The main problem that in this folder /public/team there is another folder /public/team/team (not sure why), where my index file is updated, when I update the code. As a result, instead of automatic update of the whole web-site content, I am forced to move .html index file from /public/team/team to /public/team manually, which sucks. Basically it forces me to have a separate index .html index file for each web-site tab, otherwise, the website has different views, when I switch tabs.
I obviously googled how to fixed this, but I found these Hugo content guideline tips not very intuitive for my level of expertise of working with blogdown/Hugo.
Thanks!

Silverstripe not using HomePage.ss as Chrome?

Hi I followed the Silverstripe lesson https://www.silverstripe.org/learn/lessons/v4/working-with-multiple-templates-1, and even tried to download the code from repository but when I tried to create templates/HomePage.ss as chrome Silverstripe still uses Page.ss. Clearly lesson says "It first looks in the main templates/ directory to find the chrome for this page. If it finds HomePage.ss in there, it will select that as your chrome." What is missing?
The issue here is that you are conflating the idea between a Page template, and a HomePage template.
The Page 'chrome' template (as the lesson calls it) resides in templates/ because Page class is not namespaced, or that is it resides in the root namespace.
The HomePage class on the other hand is namespaced, and this must be reflected in the path to the template.
A main template (the 'chrome'), the template should be in templates/SilverStripe/Lessons/
A Layout template should reside in the same base, but with a Layout folder; templates/SilverStripe/Lessons/Layout
This information is featured in the lesson.
I understand you are frustrated, but spreading fear uncertainty and doubt about bugs before finding the answer to your question is not a nice thing to do.
You need to create a few folders in the templates folder, as described in that lesson:
Make a directory called templates/SilverStripe/Lessons. In that directory, create another directory called Layout/. In that directory, create HomePage.ss. The full path should be templates/SilverStripe/Lessons/Layout/HomePage.ss.
So you basically need to move your file from templates/HomePage.ss to templates/SilverStripe/Lessons/Layout/HomePage.ss
Silverstripe is buggy, I got same issue. Just switch to Wordpress.

How does Drupal add module css files to the consolidated file when flushing my theme cache?

When I clear my theme registry Drupal runs off and builds out a nice consolidated css file, but it does this for different node/page types so that I get several instances of said file existing. I mentioned this in another question I asked (and answered), but my question is, how does Drupal deduce what css files it needs to add to the consolidated version? There must be numerous different places that control what modules appear on a particular node, so what constitutes a rule for another css file being built?
Well that wasn't an easy chain of functions to follow but I think I've got there...
Every time a page is 'refreshed' (i.e. built from scratch, not served from cache) all CSS files added with drupal_add_css() during that page build are aggregated and saved to a single file that is returned as the <link> tag for that page.
The following line in drupal_add_css() decides what the aggregated CSS file's name will be:
$filename = 'css_'. md5(serialize($types) . $query_string) .'.css';
$types in this context is an array of all of the CSS files added using drupal_add_css() during the current page build. The filename for the aggregated CSS contains a serialised string of $types, which essentially means that any other page that adds the same CSS files as that one will receive exactly the same file name and thus load the same CSS file.
So basically, the aggregation function is run for every single page build so all CSS added to that page will be aggregated every time. If certain pages happen to use the same modules then they will automatically be served the same CSS file as defined in the PHP snippet above. When you combine that with page caching you get the results you find in the HTML source on the different pages.
Hope that makes sense!

asp.net - Include CSS file only one

I'm stepping in to a project that has been going on for a few years.
One of the issues I saw immediately is that CSS files are being included in the master pages, the aspx pages, user controls and more, and also style sheets are created and imporeted via aspx files, and not linked. (A mess, I know)
It becomes impossible to debug styling issues.
What would be the best strategy for removing the double imports? Is there any built-in method to insure files are imported only once?
Thank you!
One way will be to have all CSS files embedded as resources then use Page.ClientScript.RegisterClientScriptResource.
Another way is leave the files as they are now and use Page.ClientScript.RegisterClientScriptBlock to include them after checking if already included by Page.ClientScript.IsClientScriptBlockRegistered giving it the unique key used in the Register method.
Either way, you'll have to remove the CSS includes from the .aspx itself and put it in the code behind.

Resources