How to load one javascript file on all forms without adding it manually in crm 2011 - dynamics-crm-2011

How can I load javascript file on each page instead of adding it manually each item in Form Library. For example I want to always load jquery and a helper js file on any form.

Supported
The best you can do is have a button configured to show on the application ribbon or for all entities that includes the library as an action.
That way it will probably be loaded whenever you need it. It is only really of any use if you have a button you can attach it to though.
Unsupported
Inject the JS library into your pages using IIS

Maybey you can update edit.aspx once and include your script there.

Related

Issue related to layout of custom webpart

According to requirement of application, I have developed a custom web part in Kentico 9. This web part is using with same functionality at various places but we have to use with different layout structure.
As per my understanding, we can create custom layouts for a single web part from "Layout Tab" in web part configuration. As I used same things with various Kentio built in web part like Logon form, Logon-Mini form, etc.
But while trying to create new layout for my custom web part, I am getting web part loading error and when I checked into event log it is showing following error:
The file
'/CMSVirtualFiles/WebPartLayouts/=vg=87a868ce-926c-4cb3-a441-b4f1d4310afc/TDNForgottenPassword/ForgottenPassword.ascx.cs'
does not exist.
Here, internally system looking for ".CS" file under "CMSVirtualFiles" folder, which has actually under the "CMSWebParts" directory in which I have created my user control.
Is there any specific configuration required in custom web part to implement multiple layout of it? Please help me and guide me, what am I missing or doing wrong?
Check your webpart code file property in the ascx file. You need to specifically declare the full relative path to the .cs file and not just the filename. For example:
Correct
CodeFile="~/CMSWebParts/Community/GroupRegistration.ascx.cs"
Incorrect
CodeFile="GroupRegistration.ascx.cs"
Please make sure you don't have the store virtual files in the file system setting enabled.

Using custom control from another database

I need to use a custom control which is a simple navigation bar from another database
navigation bar is made with twitter bootstrap css framework,
why do I need to use a custom control from another database?
because this navigation bar is going to be common to four notes Databases,
how can I implement this more efficiently?, a control that is common to four databases
Domino includes template inheritance features that allow either an entire application or a specific design element (like a Custom Control) to be updated whenever the template design changes. You could link the shared Custom Control in each of your four applications to a common template so that, if you need to make changes to it, you only have to change it in one place. You can not reference a Custom Control that only exists in another application; you'd have to store it in each and link the design to keep it synchronized.
Alternatively, you can use the Extensibility API to convert it to a library component. Controls of this kind can be used in any application running on a server that has the library installed. A video tutorial for this process can be found here.

Want to write HTML Content on a WebPart for Sharepoint

In developing Sharepoint Webpart, if I need to add HTML Content to the output of my Web Part, right now I do it like this :
this.Controls.Add(new LiteralControl("<html content>");
If I need to output a large HTML Content with Data in it, I need to instantiate a lot new Literal Contents then there is a problem, that it will make my process slow and memory consuming.
Please tell some alternatives to this approach.
Just use a visual webpart where you get to use the WYSIWYG designer and if it needs to be deployed in a Sandboxed environment you can download one from the Power Tools extension.
Oh God, writing all that markup from code is a nightmare. By using a visual webpart you can make amazing looking webparts.
If you are going to use your own scripts or CSS files just create mapped folders for them and set the deployment option to their path.
You can approach this problem by analysing webpart rendering time by using Developers DashBoard (only in SharePoint 2010). To enable this you should use powershell code like this:
$svc=[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ddsetting=$svc.DeveloperDashboardSettings
$ddsetting.DisplayLevel=[Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand
$ddsetting.Update()
When DD is enabled use this instruction to chceck your rendering time on server side:
http://blogs.technet.com/b/speschka/archive/2009/10/28/using-the-developer-dashboard-in-sharepoint-2010.aspx
You can also use monitored scopes (SPMonitoredScope) to check parts of your code which can take most part of rendering.

sharepoint 2013 jslink override

The new SharePoint 2013 property on a web part called JSLink allows me to add some override code customise my web part.
How can I pull in libraries like jquery into that code rather than add into the master page or require manual edits to ensure its on the page. I'd like to keep it self contained in the one JSLink js file?
Separate the scripts you need to load by using the pipe | symbol in JSLink e.g. /_layouts/15/jquery-2.0.3.js|/_layouts/15/jquery-ui.js|/_layouts/15/mytemplate.js

Which is the better approach in custom pages?

I want to create a custom new item page for sharepoint but there are two approached that I
can use and I want to share your experience in determining which is better.
The first: is to create a page in a library then create a C# library project to handle
the events of the controls on the page.
The second: is to define a feature of the content type of my list and specify the new
item form to be my custom form, then create a website containing the custom form and put
this site at the layouts folder.
for me the first approach is fine but the problem is that a user may access the default
sharepoint new item form which I don't want to happen.
but I don't like the idea of placing the form in a library on the site.
so which is better in your opinion ?
thanks
i suggest you to go with your second approach ...
Create a completely new feature that allows you add your functionalty of page creation and any customization realted to that and deploy this one to the 12 hive features folder as a new feature and every time you want have such a page created you can you this template and create the page...
Well, frankly, I'm confused by both of your suggestions.
I don't see how the first one would ever work.
And the second one; you don't "put sites in the layouts folder".
Here's what I would suggest you to do:
Download and install the WSS Extensions for Visual Studio.
Create a List Definition using these new templates.
Copy the NewForm.aspx from the 12 hive and Customize it.
Download and install the WSP Builder from Codeplex.com
Add your custom list definitions and files to a new Feature project in WSP Builder.
Package the Feature up to a .wsp using WSP Builder and you are good to go.
Your custom page(s) should be placed in your custom folders in my opinion.
Hope this helps.
Your concern in the first approach is that people will still be able to access the default form. If you are not opposed to using a custom control template for a content type definition, I recommend creating a very simple redirect control template and assigning it to the content type's "New Form". Such a control template need only contain one custom control, which has an OnInit or OnLoad method that contains little more than a Page.Response.Redirect call. Make that redirect point to the page you create in your first approach, and now whenever anyone tries to access the default new form for that content type, they will instead be directed to your custom page with all of your custom code. It is perhaps a bit of a hack, but it's definitely functional.

Resources