Layout Page not rendering Some Pages Asp.net MVC5 - c#

i am trying to develop MVC5 applicaiton. i am facing a problem. i have set a layout page placed in shared folder. Home pages of all controls are working properly.
but other pages are not showing in proper way.
I have attached a sample page Details
I checked css is also showing in source but page is not displaying in proper way
Thanks in advance. i am new in MVC

If you open your browser's Developer Toolbar and review the network tab you should be able to see if your pages are returning 404 for the files. When your browser is open press F12 and the toolbars should open.
It looks to me like your references to your local/application based stylesheets/javascript are missing the tilde symbol ~ at the beginning which means in ASP.NET the server-side application root.
For example ~/Content/bootstrap.css would be translated to the URL of the bootstrap.css file that's in the application's root.
You can drag and drop the bootstrap.css file in your content file into the _layout.cshtml file to see the correct path for the href attribute.

Put the sympole ~ before the link of css path

Related

CSS template not working with Login.aspx page

I've finished building my ASP.NET website. I downloaded many templates for the design, I applied them to the master page, and they worked fine for my pages.But "Login.aspx" and "ChangePassword.aspx" and "ChangePasswordSuccess.aspx" and "Register.aspx" which are built in with the website don't apply the templates!
They are not applying the new look only, They worked fine with the default style
Can any one help me with this, I don't understand the problem.
Thanks.
try to write the path of the css file with ~ or with ../
ex:
href="~/Styles/Site.css"
href="../Styles/Site.css"

Loading html page from a template on the computer

I am working with a C# on visual studios.
What I would like to know is if it is possible to have a html template loaded from a directory on my computer. Then every time I load up my code it will load up the .html template automatically.
Yes there is a way, not suggested but exist. You can use this code to include the file, inside your asp.net page.
<!--#include file="template.htm"-->
What is dose is that is load this htm file and show it on the place that you have place this declaration. Also you must know that this file can not contain anything dynamically. This is a command code that comes from the old asp script code, and still work on asp.net
So I can not call it as template. If you wish to make something like a real template you must use a master page. Using a master page is far better, and you just copy paste your htm code inside the master page and there you have it.
relative: http://triaslama.wordpress.com/2008/11/19/how-to-include-file-in-aspnet-pages/

How do I use Firebug to find out how many CSS files are being used on the page?

I recently came across this error in IE9 that says :-
"The maximum number os style sheet on this page(31) has been reached. The browser will not load these excessive style sheets...."
Now on my website's master page, I have placed this Telerik control "RadStyleSheetManager" which is supposed to combine the style sheets if I am not wrong. I thought would solve the issue but no results.
Someone please point me towards the right direction. How do I find out the number of CSS files and how should I really use the RadStyleSheetManager to make my aspx pages load faster.
In Firebug you can:
open CSS tab to see all the files with their content
open Net tab to see all the requests and find your CSS files there (filter using CSS button in the toolbar)
you can look at the net tab in firebug to see all the request for css files

If the master page uses a css file, will other file be able to use that css file too?

I use ASP.NET Master Page to organize reusable site elements and common styling. In other pages, I declare MasterPageFile="~/Site.master".
My problem is that I use a CSS file in the master page, I thought that my other pages would be able to use that CSS file without declaring it again, but I couldn't :(
Can anybody tell me what i did wrong?
The child pages that uses that master page have access to to css file. You can assure that by open your child page using your browser and view source. There you'll see the link tag to your css file.
I think the problem is that in your css file you used the element ids. The problem is that wrapping the page with master page changes the ids of the elements.
Chack that.
It probably because the css linked in your master file is using relative path. And the relative path becomes incorrect when your page file uses the master file. You need to make sure the css file's path is relative to the page file.

JQuery not working in IE

I am using the Tiny slideshow in my asp.net page. It works fine in all the Browser and here is the LINK, But my problem starts when I include that page in my master page and display the same. the Jquery stop working in Internet explorer.
http://www.spareach.com/public/xtemp8.aspx?userid=22&AspxAutoDetectCookieSupport=1
I am tired a lot for this.
Can any one help me please.
your script interpreted by ASP.NET Session. the actual URL of file is http://www.spareach.com/lightbox3/script.js. if you put the absolute URL then they work fine. hope this helpful
If you include that in another page, your relative link to the .js file is going to be invalid. So, your options are to make it absolute (http://www.something.com/folder/tiny.js) or to include the .js from the head or common document, if you use that structure.

Categories

Resources