ASP .Net MVC Web Application integrating bootstrap templates - javascript

I know I will probably get too many down votes for this question, but I just could not find a tutorial to my problem.
I have created a ASP .Net MVC project in Visual Studio 2013 (New Project -> ASP.NET Web Application -> MVC) and I am trying to change the default bootstrap for this project, I have downloaded bootstrap templates from different websites but I just can not use them in my project. I have followed a few questions on SO and some tutorials but all I could was change some styling, not entirely use the template I want to use.
Tutorial that I read:
http://www.mytecbits.com/microsoft/dot-net/bootstrap-with-asp-net-mvc-4-step-by-step
http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-with-asp-net-mvc-5
SO Questions:
bootstrap 3 template change mvc5
Bootstrap Jumbotron not becoming full width of Body
After reading above questions and a few more tutorials here and there, I was able to change the theme but not the template, I want to use a parallax theme like this one
I copied the css into bootstrap.css, javascript into bootstrap.js and HTML into my page Home page but then _Layout.cshtml is messing up the display...
My Questions:
1.) Am I doing this the wrong way?
2.) What changes should I make to the _Layout.cshtml file to display the template properly?
3.) I read that there are different versions of bootstraps, the default version that is used in the project when I created it is V3.0.0 and some templates that I downloaded are V3.1.1, Will they be compatible? I followed this to upgrade the bootstrap version of my project to V3.1.1 after that some more .js and .css files were added to my project and things got more complicated.
4.) What will be the _Layout.cshtml file if I use bootstrap V3.0.2 ?
Any help will be appreciated...
EDIT:
I am trying to use this template:
Template
Template

Integrating Bootstrap Template into ASP .Net MVC 5:
First of all create a new Project:
Web Application -> MVC
Run your Project by pressing F5, it will look like:
Now check that your downloaded Bootstrap Template Folder contains following:
css (Folder):
bootstrap.css
bootstrap.min.css
js (Folder):
bootstrap.js
bootstrap.min.js
Note: Sometime bootstrap.css may be named as style.css and bootstrap.js may be named as style.js
You will be making changes to following files in ASP .Net MVC Project:
bootstrap.css
boostrap.min.css
bootstrap.js
bootstrap.min.js
Open your all the files mentioned above in code editor:
Now do the following:
Copy all of the code from bootstrap.css (Template css Folder) to bootstrap.css (Content Folder)
Copy all of the code from bootstrap.min.css (Template css Folder) to bootstrap.min.css (Content Folder)
Copy all of the code from bootstrap.js (Template js Folder) to bootstrap.js (Scripts Folder)
Copy all of the code from bootstrap.min.js (Template js Folder) to bootstrap.min.js (Scripts Folder)
Now its time to adjust your _Layout.cshtml according to the Theme. We will be splitting the index.html file from the Theme folder into two parts, one part will go into _Layout.cshtml and one part will go into 'Index.cshtml`:
Replace your _Layout.cshtml code with the code below:
_Layout.cshtml
Replace your Index.cshtml code with the code below:
Index.cshtml
Now run your Project it will be like:
Link
This is how I solved my problem.

Bootstrap is just the basis. A template may also add additional features in order to be rendered correctly. Things that may or may not be based upon bootstrap. It could also be an older version of Boostrap, or a newer as Boostratp has been at 3.2 for a while.
Usually, you include the main bootstrap.css first, then the css file(s) that the theme uses. Before you reference the bootstrap.js file, load jQuery. There is no set way to make your _layout.cshtml look good without
1) knowing what is wrong. We have to see the rendered code to really understand what is missing
2) What template you are attempting to apply since you may be missing the css or some elements that it uses.

There's a great and simple way to get everything you need to get going. Use Chrome and hit F12 to open the developer tools. Right-click over the area that displays the rendered layout and choose "Inspect Element". It will open the DOM for the entire page but will select an item within an iframe. Find the element immediately within the iframe and right-click and select "Copy as HTML". This will give you the layout as well as script css and script order.
The css that shows in the bootply editor window doesn't go into the bootstrap.css file. It's rendered inline into the code that I showed you how to get at but you can place it into it's own CSS file. Just make sure that CSS file is loaded after the bootstrap css file.
Just for reference, the template appears to be using Bootstrap 3.0.2, which isn't too old but isn't the most current.

Related

Stop the bootstrap or JavaScript file override

In my html page I added in the the cdn of bootstrap which I implemented for carousal only and in the bottom part of the my custom javascript file main.js for other dynamism but my javascript overrides the bootstrap.
Please what should I do to make both the bootstrap and my main.js file work together without any overriding the other?
I've tried placing the main.js file in the <head but no change was found.

Semantic UI modules correctly styled but not responsive

I am quite new to JS and Jquery and I fear that I must have missed something fundamental to incur this error: none of the semantic modules I tried to include in the html and initiate with JS appears to be responsive, even when I just copy the snippet from semantic ui examples.
I used bower to install Semantic UI and Jquery to a separate bower_component directory which I then added as an additional content root to the project directory in phpstorm. I included semantic files in the html header as such and paths are all recognized:
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<script src="jquery/dist/jquery.min.js"></script>
<script src="semantic/dist/semantic.min.js"></script>
<script src="js/semantic_test.js"></script>
I copied the html from the first example this link to the html and the js to "js/semantic_test.js". The page is appearing static with all the styling correct but no response, in Chrome or Safari.
I tried some bootstrap components which functioned correctly. I have also tested CDN paths for both Jquery and Semantic UI - not working still. I have spent hours googling and would deeply appreciate some help please!
Did you wrap your jquery code in document.ready
$(document).ready(function() {
// your code here
// ...
});
Sometimes this can happen when the script to initialize your html components with JavaScript runs before the components are loaded into the dom.

CSS working on based URL but not in other pages of the site. CodeIgniter

I am creating a simple website. I got a responsive HTML template but the problem is the CSS only works on the based URL but when I started to click the other links the CSS was not applied. I am using CodeIgniter framework. I already tried to change the .htaccess file but with no luck. I am sure that I have used proper declaration of the HTML tags because the CSS showed on the main page (base URL). You can visit the site for your reference
For your reference. Here are the .js and .css included in the template I am using.
http://barangayxyz.net23.net/js/skel.min.js
http://barangayxyz.net23.net/js/init.js
http://barangayxyz.net23.net/js/skel-panels.min.js
http://barangayxyz.net23.net/css/skel-noscript.css
http://barangayxyz.net23.net/css/style.css
http://barangayxyz.net23.net/css/style-desktop.css
It will be a great help if someone can answer my question.
If you are using CodeIgniter, place your JS and CSS files outside the application folder. Then fetch your files from these directories
So instead of : http://barangayxyz.net23.net/js/skel.min.js
Write it as : http://barangayxyz.net23.net/your-assets-folder/js/skel.min.js
See directory structure below:
root
- application/
- system/
- your-assets-folder/
- css/
- your-css-files
- js/
- your-js-files

Ext JS 4.2.1 + Sencha CMD - ItemSelector Buttons CSS not loaded

I generated an Ext JS 4.2.1.883 application with the sencha CMD 3.1.2.342 using nthe neptune theme...
I've got an ItemSelector Control in my View with the Buttons 'add' and 'remove'..
I executed a sencha ant cleaen and sencha app build still my Buttons of the ItemsControl are without any Icon. It seems that my generated Appname-all.css does not include the CSS of the ItemSelector.css file in my ext\src\ux folder where e.g a style would be defined for the css class .x-form-itemselector-add. In the Appname-all.scss file i found a variable $include-ext-ux-form-itemselector which is set to true. I dont know how i can fix this..
I already tried to write Ext.require('Ext.ux.form.ItemSelector'); and Ext.Loader.setPath('Ext.ux', './ext/src/ux'); in my application.js file.
I dont know how to proceed - please help!
When I look at the multiselect example in the Ext JS docs, inspecting the buttons in the middle (e.g. "x-form-itemselector-add") clearly show the CSS is not part of the theme - it's a completely separate CSS file.
In fact, just looking at the HTML source code shows the CSS file.
You'll need to add that CSS to your theme manually and then recompile. The Sencha UX JS and CSS files don't have auto-inclusion flags via Cmd.

Is separate boostrap js plugin file is required?

I am using twitter bootstrap in my project and i am a beginner for bootstrap. I want to know that if i downloaded bootstrap.js and bootstrap.css and after that i want to use bootsrap js plugin like carousel, popover etc then i have to download a separate js file for each plugin or not ?
And if yes than is there any way to download a single bootstrap.js which cover all js plugins and boostrap.css which cover all js plugin css ?
you could do that either way
the generic bootstrap.js and bootstrap.css contains the entire bootstrap tools and widgets
Alternativly, you could create your own bootstrap with only the things you need on
http://getbootstrap.com/2.3.2/customize.html
and yes there is a way - http://www.bootstrapcdn.com/
2 lines of code and you got bootstrap
Plugins can be included individually (using Bootstrap's individual *.js
files, or all at once (using bootstrap.js or the minified bootstrap.min.js.
bootstrap.js includes them all. Why don't you check inside the file for its content?
You don't to download separate js file for each plugin. bootstrap.js and bootstrap.css are common files for all plugins.

Categories

Resources