Just tried out VS2012 with the default template site and I'm totaly new to the concept how to include javascript and css. In the MasterPage the javascript seams to be included using the scriptmanager and scriptreference.
There are also some files like package.config.
Can someone explain how this is supposed to be used. How do I include my own javascript & css. How do I add a jquery ready() to the site.master?
To inculde a css file to your site add a link tag in the <head> section of your page, for javascript add a script tag.
<head>
<link href="file.css" type="text/css" /> // This wil include your css file
// For JavaScript
<script src="jquery.js" type="text/javascript" ></script> // This wil include your java script file
<script type="text/javascript" >
// write Your JavaScript code here
// For using jquery code, add jquery method inside the script tag, example below
$("document").ready( {
// your jquery code
});
</script>
</head>
Script manager is used for different purposes:
1) Using Ajax Controls
2) When we access web services in Client Side
3) Page Methods etc
From MSDN about ScriptManager:
You must use a ScriptManager control on a page to enable the following Microsoft Ajax features of ASP.NET:
Client-script functionality of the Microsoft Ajax Library, and any custom script that you want to send to the browser. For more information, see Creating Custom Client Script by Using the Microsoft Ajax Library.
Partial-page rendering, which enables regions on the page to be independently refreshed without a postback. The ASP.NET UpdatePanel, UpdateProgress, and Timer controls require a ScriptManager control in order to support partial-page rendering.
JavaScript proxy classes for Web services, which enable you to use client script to access Web services and specially marked methods in ASP.NET pages. It does this by exposing the Web services and page methods as strongly typed objects.
JavaScript classes to access ASP.NET authentication, profile, and roles application services.
Related
I am migrating an aspx application in to Pega which has heavy UI pages.
When I tried to render the respective HTML in the form/ user interface tab of PRPC, most of the UI controls did not render and have to do heavy Pega coding to make it work.
Are there any best practices or tools available to optimize UI design by converting aspx pages UI elements in to Pega?
I can understand out-of-the-box customized controls cannot be rendered unless there is a converter.
No, how should that be possible? PRPC runs on a Java Application Server (Tomcat, Websphere or Weblogic) and thereby executes Java / JSP code - acting as a platform. The same way you can't just reuse php snippets in your Pega application.
In PRPC one UI rule type are sections. Sections are preferably auto generated, but you can choose to put in HTML code or even JSP code instead. There you could leverage the JavaScript frameworks included in PRPC or do includes on an iFrame basis. But you can't paste there php or aspx code since it won't be executed on the php resp. aspx environment.
Hello Meteor.js experts,
If you make a GET request to any page you will get something like that:
<!DOCTYPE html>
<html>
<head>
<!-- Some meta tags here -->
</head>
<body>
<!-- Bunch of scripts here -->
<script type="text/javascript" src="/app/app.js"></script>
</body>
</html>
I mean head of site, a bunch of scripts and that's all. No any markup code. I understand that Meteor is client side rendering framework. I need generate html on server side with this head and scripts for SEO. I need this scripts in order my application work on the client side normally, as usual Meteor application.
I tried to use Meteor-SSR, but it's not generate the scripts and head.
Is there any way to get this code (or only scripts list) on server side? And can I handle this script list? Can I remove some scripts out of there?
The "bunch of scripts" appears normally only in development mode.
Once you build for production (or simulate with --production flag), all of them (including your app.js) are bundled and minified into a single JS file. The scripts which are specific for debug are not included.
As to come back to your main concern, you could try Meteor-SSR package:
Now, you can render Blaze templates on the server very easily. And also, you can assign helpers for templates in the server as well.
An alternative which is not exactly SSR is the Fast Render package:
Fast Render can improve the initial load time of your app, giving you 2-10 times faster initial page loads. It provides the same effect as Server Side Rendering (SSR), but still sends data over the wire to avoid breaking one of Meteor’s core principles.
With this package, you keep the very same client-side rendering even at start up, but the initial data is sent within the HTML page, eliminating the waiting time for the script to subscribe and receive the data from that extra request.
I have a page test.aspx which is inheriting master page.The master page has script manager addeded to it.I am trying to add the rating control availabel in the ajax control toolkit.
So i need to add the line <Ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>
But since the script manager is already availabel in master page i cannot add this line to my test page.And if i dont add it will not function.
What should i do?
Is there difference between script manager and toolkitscriptmanager.
How to use both simultaneously?
You can replace the scriptManager in the master page with <Ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/> .This will certainly solve your problem.
First of all: if you use ASP.NET 3.5 and controls from AJAX Control Tookit then you must use the ToolkitScriptManager, rather than the ASP.NET ScriptManager. This limitation according to the fact that toolkit script manager adds updated Ajax scripts and without that most of the controls from Ajax Control toolkit library will not work.
If you using ASP.NET 4.0 (4.5) than you have choice to use ScriptManager or ToolkitScriptManager.
Basically the main feature of the ToolkitScriptManager is that it can combine js resource added to page using ScriptReference collection. These js files should be embedded to assembly and for this Assembly ScriptCombine assembly attribute should be added. The main problem here is that you can't control how scripts are combined and after you will try to combine your own scripts you can have a lot of problems (I had experience using this feature and as a result we rejected combining of our scripts using this approach).
The main point here is that currently standard script manager has ability to combine scripts using composite script collection.
I am developing a web application which will be added as a custom page in Tridion.
On the custom page I'd like to select a component of schema X. I want to use the ItemSelectControl for this purpose but I don't know how I can open that control from my custom page since I am not able to access any of Tridions javascript namespaces (e.g. $model or $const). I could simply open a new popup with the url to the ItemSelectControl and create my own filter in json but I'd rather use the constants defined in Tridions javascript namespace.
Is there a simple way to add references or something to my web application in order to access Tridions javascript namespaces? If not, do you have any suggestions how I should solve this?
More information on the custom page:
CMS server hostname: testcms
An empty ASP.NET project with one aspx page called Test.aspx published to path C:\TestPage\
In IIS, a web application called TestPage in the SDL Tridion site with path to C:\TestPage\
Trying to access the page in a broswer with url: http://testcms/TestPage/Test.aspx
You can accomplish this by using the following markup/code for your popup. (Popup page must be an .aspx page)
<%# Page Language="C#" AutoEventWireup="true" Inherits="Tridion.Web.UI.Controls.TridionPage" ClassName="DashboardView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html class="tridion popup">
<head>
<!-- Tridion manager -->
<cc:TridionManager runat="server" Editor="CME">
<dependencies runat="server">
<dependency runat="server">Tridion.Web.UI.Editors.CME</dependency>
<dependency runat="server">Tridion.Web.UI.Editors.CME.commands</dependency>
<dependency runat="server">Tridion.Web.UI.Editors.CME.globalCommands</dependency>
<dependency runat="server">Tridion.Web.UI.Controls.Popup</dependency>
</dependencies>
</cc:TridionManager>
</head>
<body>
My popup
</body>
This means that there is a dependency between your application and Tridion, because your popup page must inherit Tridion.Web.UI.Control.TridionPage. It's up to you if you want this. I don't know of another way to add the Tridion JavaScript files.
(This approach is also used in the PowerTools project. Check it out here: http://code.google.com/p/tridion-2011-power-tools/)
If you want to develop your own web application that connects to SDL Tridion (so you can use it as a Custom page or in a Custom URL for example), you should use the Core Service. This allows you to interface to the Tridion API without needing to copy (parts) of the SDL tridion Web.Config.
An example of how to use the Core Service is given on SDL Tridion World: Item Selector Custom URL eXtension
This example shows you an Item Selector build using the Core Service. Its is specifically designed to be used in a Custom URL (the link you have in Schema Fields), but can easily be converted to be used in your own web application or in a Custom Page.
Only when you are creating a SDL Tridion UI extension, you can (or should) use the Tridions javascript namespaces.
i am using jquery and jquery ui plugins in my web application.
and i have some asp.net server controls that they register their scripts on the page.
Since my application should be work Local could i put all scripts in master page ?
all scripts i mean jquery script and jquery Ui scripts such as DatePicker Dialog and effects.
or is there any better way exist?
because i want to jquery in all my pages and user Controls.
thanks.
Sticking them in the master is definitely the simplest approach if you intend to have them available on every page.
It sounds like you're including all the scripts individually though, you can include just one file for jQuery UI, for instance:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
Yes, put them all in the Master Page.
Once they're downloaded, they'll be cached in the browser (if they already aren't)