Client-side solution similar to asp.net master page - javascript

I recently started using WebStorm to implement web applications and find the experience much better than using Visual Studio.
I am considering moving the "view" part in mvc to pure html as much as possible without relying on server template engine such as Razor. So that I don't have to open visual studio until server side code is needed.
Google results showed that client side template engines such as Handlebars and Mustache will be able to help generate dynamic html pages. One thing I have not found is that ability to combine "parts" of pages together (like the master page in asp.net) so that we don't need to copy/paste header/footer everywhere.
How do I achieve "master page"-like functionality with client side (i.e. javascript) solutions?
Thanks for your help.

You could try this:
use 'shtml' file to struct your webpage,so that you can reference the include instruction:
<!--#include file="head.html"--><hr><b>Hello,this is body!</b><hr><!--#include file="foot.html"-->
As to 'head.html' and 'foot.html',well,you know what should include in them.Actually,they are 'div' segments~~~

Related

how can i use Django with html CSS JS?

I am making a website and through some sources. I find out that Django is for backend and html CSS and JS is for front end.
So I am designing my pages in the later 3 and not started developing the backend.
Is there any way that I can use Django with html CSS and JS? (please suggest an easy method as I am a newbie ,however I am quite familiar with python )
Django would be used to match urls with pages. Specifically you would need to create a view that renders a template (here comes the html) and some static files (css, js). If you wont use a database i would suggest that you use flask which does the thing is described above much more easily.

getting confused about .aspx and .html

i am new to asp.net and i have started learning asp.net and i am excited about it.
my questions are...
1.what is the main difference between .html and .aspx page?
2.i wanted to know is there any difficulty while it comes to apply styles and javascript code to aspx page . till now i have experienced in developing client side applications using html,css,javascript,jquery(static web pages no dynamic data will be loaded). this time i am going to do with .aspx is there any obstacles in making web site beautifully with asp.net ?
HTML Page : A Web page with user interface and content static information that does not go through any server-side processing.
ASPX Page : A Web page with user interface and dynamic content information that is coming from server-side. This type of page will render the HTML content in the browser. ASPX page is dynamic and has server control support.
Is there any difficulty while it comes to apply styles and javascript code to aspx?
-- The CSS and JS are applied in the aspx pages in the same way as you do it for HTML. The only difference comes when you use Master Page. In that case, you just need to be sure about the id's of the elements as they are dynamically generated
HTML is a Markup language (it defines the page structure)
CSS stands for Cascading Styles Sheets they defines the style of the elements in the page
ASP is a server side programming language (that means that is elaborated by the web server)
Javascript is a clientside programming language (that means that is elaborated by the user's browser)
Basically this is how it works:
Web server process the asp data and then return to the user the HTML result, now the browser can elaborate the html (apply styles from the referred CSS stylesheet, execute Javascript etc.), there is no particular difficulty that other languages doesn't have.
If you want to Know more about Server side languages: https://en.wikipedia.org/wiki/Server-side_scripting
Happy coding!
There is no problem using Asp.net, you will have the same result because the browser will display the result with HTML and CSS. You can use JavaScript in the same way and you will no have problem in the result.
Asp.net give more advantages to add functionality to your projects.
So, do not be afraid to learn this language :)

Attach PDF to PDF as attachment (not as a page) via Javascript in HTML (not in Acrobat)

I would like to generate a PDF portfolio using JS from an HTML/CSS page on a local machine. I would use a PDF template file which includes a PDF portfolio Navigator in SWF form. I have successfully accomplished this using C# and a command line program, but can not identify the proper Javascipt components to do this browser-side or pseuo-server with Node.js. Basically, I am looking for something which will allow me to append a PDF to a new or existing PDF via configuration choices and an 'assemble' action using a JS or HTML button. iTextSharp provides the required PDF interaction functionality, but I can not figure out to run this inside an HTML to allow configuration via the HTML/CSS DOM (i.e. checkboxes, text field desciptors, etc...). Does a library with this type of functionality exist?
So you want to create a PDF using JavaScript?
On a quick google search, I found what appears to be a javascript library for creating and manipulating PDFs call jsPDF
If you want information on how to upload files with JavaScript alone, here is an article on how to do that. It also shows you how to use the file element.
For style, I recommend using a CSS Framework is you don't know much about CSS. I personally use Twitter Bootstrap for quickly prototyping things. It's quick and easy, and has good documentation. You can also use this to see how to make a form in HTML. I haven't got any good starter tutorials for HTML off the top of my list, sorry.
If you don't know much about JavaScript, when it comes to getting the options from the form, so that you can use them as configuration options, I'd suggest using the jQuery framework. It'll help you get up and running quickly enough
Note, all of this shouldn't replace basic training in JavaScript and HTML/CSS. Frameworks make things simpler, but if you don't know how to do something without a framework, you're going to have a hard time with a lot of the more complicated things. This goes for every language

Reusing HTML code with only client side technologies

I am tasked with creating a website using only client side techs such as HTML, CSS and JavaScript. We can't using any server-side tech because the instructor is too lazy to install anything and won't allow us to deploy using something such as Heroku. Is there a way I can do this? In particular I want to create partials for that navigation and footer without having to copy and paste them in every single file.
I know of two different approaches:
1. Using Ajax
You can use ajax to do this - probably with the help of a JavaScript library or framework.
JQuery's load can do things like $('#header').load('header-partial.html');
If you're building something more complex with a lot of views, etc... I'd consider using a MV* javascript framework like Backbone.js or AngularJS.
Check out the AngularJS seed project on GitHub for an example
2. Using a build script
If your site is simple enough that all you want to do is include a header and footer on each page, you should consider doing this as a build step in your deployment process. I.E. complile your html with the partials locally, and upload full pages, with the header/footer code on every html page.
This approach has the benefit of not breaking your site if js is disabled.
For an example, check out html5boilerplate's ant build script

ASTreeView help! (using JavaScript with .dll's)

I love the demos of ASTreeView. I'd like to use this in my project, which is completely local and currently only uses HTML, JavaScript, and CSS - i.e. no ASP.net or anything dealing with servers...
Is it possible for me to use this? There is a .dll and a .js included in the package, but I have no clue where to start since this isn't a ASP.net project for me. I can't find any documentation on this library.
ASTreeView is a ASP.NET server side control. It is used on .aspx pages that are typically run on Microsoft IIS servers or any other server supporting ASP.NET. Take a look at ASTreeView - Free ASP.NET TreeView Control on CodeProject.com for a nice tutorial on this free control.

Categories

Resources