Want to know C# .Dot net MVC Helper Class css file Location - html.textboxfor

I have made a custom HTML CSS file and pasted in view of MVC. I had successfully replaced all the HTML tags with Helper classes like TextBoxfor, so that it could be tightly bonded with model. But after doing that it is also adding its CSS file, which inturn disturbing my custom HTML browser page. I am unable to trace the location of CSS file related to Helper Classes.
"Can any one tell me where the Helper Classes are taking its own CSS or in which folder does the CSS of Helper Classes are present."

Related

CSS definition stripped from final bundle

I'm using Angular CLI and it's preconfig'ed webpack bundle. I have a bit of HTML that's inserted into a template via [innerHTML] and want to apply styling to it, but I notice that the final styles.bundle.js doesn't contain the style I write. I assume webpack is smart and strips out the CSS definition since it's not in any template, but being added via JS.
In my template I simply have this:
<div [innerHTML]="message"></div>
Which gets a value in the controller such as:
this.message= '<p class="notice">Your account was successfully activated!</p>';
And while I have .notice defined in my .less file, it doesn't appear in the style bundle. When I had the notice class previously in the template itself, it worked fine.
Is there a way for me to keep this from happening? Should I be coding differently? Or is the problem elsewhere and not what I think it is?
Since the HTML being added by innerHTML is not directly in the scope of Angular, I needed to add /deep/ selector before .notice in my less file, to make sure children can access the CSS value.

EJS Tags in external css

I'm trying to refactor a nodeJs project and my css is in my .ejs file. I need to put some dynamic data in my css file. I need to have dynamic data in my css, when my css is in my EJS file it's good.
But when I put my css into an external file, nothing happens!
So, how can I inject ejs tag in my external stylesheet file?
This is one of the questions to which one has to ask you - why do you want to do that? You are asking about a solution to a problem that you didn't describe.
By suspicion is that you are trying to use a templating system for something that could be done with a CSS preprocessor like Sass or Less. Particularly Less can be easily used on both the client side and server side. See http://lesscss.org/#client-side-usage
Now, if you really want to use a templating system created for HTML to generate CSS then you will have to take few things into account: You need to store your CSS templates somewhere where your HTML templates are stored, not where you store your static assets like images. Then, your server will have to serve your generated CSS with a correct MIME type. Then, your HTML will have to reference the styles using a URL to your generated CSS that will be generated on every request instead of being served directly from disk.

Template html and template string in web components

Is it better to use html template (and then html import) to create web components or to use template string? What are pros and cons of these methods?
Using html template files is better for reuse: the same file can be used in different web components. Also they are better displayed in most IDEs as they are recognized as full HTML code.
Using template strings is faster (inline). They don't rely on HTML Imports which is not adopted by every browser vendors. Also you can use template literals to insert directly value of JavaScript variables in the DOM.
Actually there's no much diffrences because there's a workaround for every differences list above (i.e. you can reuse template strings if you save them as text file, or you can load html templates withour HTML imports).

Css classes not added in new layout template in WebSphere Portal

I'm trying to create a custom layout template. I'm following these guide lines:
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Page_Builder-Creating_Custom_Page_Layouts_WP7_
When I upload, the layout.html is found and used by the server. The problem is that the new classes I've added to the layout.css does not come in to effect. When I inspect the page source, the divs have my classes, but the classes are not added to any css-file. I've searched through them all (from view source of the rendered page).
(I have restarted the server, emptied the temp dirs on server, reloaded in browser with empty cache)
Any ideas?!
Just adding a class name to an element does not in any way create that class in any css entry. You will have to manually add that class to the css along with any rules for styling you are wishing to have in place.

mvc3 razor, CSS in Helper

In an mvc 3 razor project I have a helper which creates a component. I can use this helper to create as many components as I need in the same page.
I have different folders containing css files and their images.
Can I specify the css style of each component from the helper?
i.e #html.MyComponent(100, 200, "pink") will uses the style.css in pink folder.
Ps: I am not using html5 neither css3
If you would use classes instead of files it would be much easier. I would just use different styles for themes. You should look at this question: ASP.NET MVC 3, how to do themes right
ASP.NET MVC 3 Razor: Include JavaScript file in the head tag
I think the same thing can be applied but I don't know if you can do it from a helper.
If you are set on doing it this way - then
You need to select the css file at the top for pink
You need to include all style sheets in loading.
You need to dynamically include style sheets when requested by MyComponent. This is tough as you may end up double including them. You can accomplish this via an ActionFilter to write out the css tags at the end, but this is a hack and I wouldn't recommend it.
Stick with convention and your styles should be requested at the top, so you need to know which styles you are using on the page. Your components shouldn't care about loading a style sheet, it should already be loaded which means you have to make this decision at the top of your page. Since you should already 'know' the names at this point (pink, etc) you can easily write the code at the top to request these files via a simply
<LINK href="#string.Format("/{0}/style.css",YourStyleSheetnameIePinkInThisExample)" rel="stylesheet" type="text/css">

Resources