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 :)
Related
As seen in numerous articles about webpage rendering. What is the difference between the two?
Another example: ("Once the request is done processing, your browser gets back the fully rendered HTML and displays it on the screen.") [https://www.freecodecamp.org/news/what-exactly-is-client-side-rendering-and-hows-it-different-from-server-side-rendering-bd5c786b340d/]
Another example: ("Server-side rendering (SSR) is an application’s ability to convert HTML files on the server into a fully rendered HTML page for the client.") [https://www.omnisci.com/technical-glossary/server-side-rendering]
Bonus points for anyone who can give examples of actual differences in the code.
This is a common term when working with Single Page Applications (SPAs) built on React, Angular, Vue, etc. These frameworks render out Typescript/Javascript into browser-readable HTML. This is different then just making a raw .html file because these framework scripts are being 'rendered' as HTML.
Based on my understanding, HTML is a markup language that can be used to make web pages. Content wise, rendered or not, it will have the same tags <html></html>, <body></body>, and so on.
The only different I see as a user is that for a static HTML page, the id tags (e.g. <div id="myID"></div>) and class tags will likely be same for each visit.
However for rendered HTML page, the ids and classes might be different each time. (e.g. <div id="myID12"></div> for 1st time, but <div id="myID34"></div> for the second).
One possible incentive for using rendered HTML is to prevent other people from using web crawlers or automated programs on the website. I hope this answers your question.
I'm working in a company where we are creating a web app, and we are moving all the legacy Yii PHP controllers to a more dynamic style.
Instead of generate HTML with PHP, the app it's moving to ask data to the java private API and receive JSON to generate HTML elements with Javascript, but there still are elements generated in the PHP code.
My question is: is it viable to use the server code (php, ruby, java...) just to generate some data in json and then create everything via javascript once it's received? (maybe everything but body, head tags :P)
Pros? cons?
If it's not a bad idea, is there any tips? Frameworks (like dust.js, backbone...) advices?
Why should I continue with this idea or why get away from it?
Edit:
Example:
A php generated page (from Yii framework using MVC as said - so not mixing backend and frontend) with the basic information like page header, side menu, footer, and some content without functionality. Once this page is received, the js takes control and adds extra functionality, right?
The other point is:
The same page but PHP not rendering anything but <html><body></body></html> (just the basic stuff, maybe something more like including js files, some headers... you know, the minimum needed) AND setting some javascript variables using JSON objects, with all the information needed by javascript to render the header, menu, body, etc.
So the pattern will be close to the one-page design by js (as backbone, angular.js, etc.).
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~~~
I have the need to expand an asp.net 2.0 web application that I recently created. Currently there is a single page that contains some embedded HTML that is needed in a separate section of the application in a new page that I am working on. On this new page, I am going to be using the HTML multiple times throughout the page, mostly duplicating the HTML with JavaScript/jQuery. So I am not sure if I want to have the HTML in a JavaScript variable or hidden in the page and then call $.clone() on the HTML to dynamically recreate it.
Is there a way to have shared HTML files within an asp.net 2.0 forms web application so that I do not have to complete dual maintenance of code; I assume similar to the way that an MVC application would work (although I am not completely familiar with how MVC HTML works).
Create it as a User Control if it's only ever going to be deployed within a single project - otherwise you would have some duplication of effort with versioning. If that's the case, re-create it as a server control and emit the HTML/JS from there; server controls can be shared across projects from their own library. You'll only need to maintain one copy.
Preface: Hi, all! Here goes. First and foremost, I am not familiar with jquery, so any jquery code posted will be irrelevant to me until i research it. I'm newly teaching myself JS. I have decent XHTML experience, decent CSS3 familiarity/understanding, and some (very little) application programming experience (C++, Java).
The Situation: I'm designing a website's home page whereon, with JavaScript enabled, links are overwritten and instead of loading a new HTML document/page for each main link, I alter sections of the home page using JS.
The challenge: I want to load new page content without loading an entirely separate page. A similar old HTML solution to such a challenge was to load page frames, right? I want to overwrite an entire container element using content from another separate HTML file on the server. (The external file could be tailored to fit into the main page, but it would be even better if I could pull a SECTION of an external HTML document, perhaps one element).
Can I do this using only JavaScript?
If not, what other scripting could be used in conjunction with JS?
Would I need to implement "AJAX"?
Must I use "HTML DOM"? - Edit: I see that DOM is just integral to the function of HTML etc.
Thank you all for your patience and your expert advice. I <3 StackExchange.
Yes you can do that using Javascript and jQuery, take a look at the load() method that's exactly what you need
http://api.jquery.com/load/
Yes it is using AJAX, but it's really easy to use don't worry.
Can I do this using only JavaScript?
No, because the server will need to serve you the content / data that you wish to place in the HTML page. You'll need to combine client-side scripting (JavaScript) with functionality on the web server (see your next question below).
If not, what other scripting could be used in conjunction with JS?
That would be your server-side language, such as PHP, Ruby, or Python.
Would I need to implement "AJAX"?
Yes, what you described is implemented using Ajax. You've mentioned the jQuery library and it indeed has functionality to perform an Ajax call to the server (see $.ajax). The basic idea is: your JavaScript code performs an Ajax call, your web server returns the HTML and then your JavaScript code receives it and places it in the HTML page.
Must I use "HTML DOM"?
Web pages always make use of "HTML DOM". You could read the article about Document Object Model on Wikipedia for more information: you have to use DOM but not by choice - it's part of how web pages work.