Use a c# function in a crm form onload/onclick - dynamics-crm

I've created a button on a CRM form and now when I click on it I want to send some info to a function that has been written in C# and then do some calculations.
My question is how to use this function from a CRM onclick event.

The simple answer is; you can't do what you ask. At least, not directly. You need to wrap your C# function in a web service and call the web service from the CRM form/button using JavaScript.
This blog post (an others on this site) could help you get started:
http://nishantrana.wordpress.com/2007/10/18/calling-aspnet-webservice-from-javascript-ajax/

Related

Execute custom code in CRM

Is there a way I can execute custom code in c# when a user clicks a button in the CRM application? I would like it a synchronous and asynchronous approach.
Actually something like when putting a button on a webform with a wired code behind click event handler.
And how can I add a button?
I want to display a list of report views the customer has assembled and access the report data in the CRM database.
It seems so complicated with CRM!
Here's an example of a custom workflow with a bunch of XAML. I dont know where they got it from.
Sample: Create a workflow in code
One way to go about it:
Use Ribbon WorkBench add add a button to the form. Only supported way of adding buttons to CRM is by editing ribbon XML.
Add an on click JavaScript Event Handler.
Call an Action which can be used to call a custom workflow where you can perform business logic.

Ajax connected webparts in sharepoint 2013

I need to implement custom treeview with categories and connect this webpart with ListView webpart. Can this be done with ajax? How? And how to pass param from provider via JS (I know only __doPostBack method, are there any other ways)?
I think your best bet is to look at the JavaScript API for SharePoint:
API Reference
And then integrate code that queries your views in a list with the jsTree jQuery plugin:
jsTree Reference
Now you can use JQuery to determine what's happening with your list view web part, but it will be time consuming. I would use the Microsoft Javascript API to create a drop down of the various views you have in your list, and then render that data in such a way it will work with the markup jsTree requires.

using client side validation with telerik controls

Can you use client side validation with telerik controls? The examples show validation using standard html input controls. I have forms with RadTextBoxes, RadComboboxes etc and would like to add validation.
You can access the Telerik client-side api by using
var ctrl = $find('<%= txtSomeTextBox.ClientID %>');
then you can get the current value of the textbox by calling the .get_value() function. Use your browser's debug tool to see which methods are available in the object that is returned or consult Telerik's help site.
Go to Telerik's online demos: http://demos.telerik.com/aspnet-ajax/input/examples/common/validation/defaultcs.aspx and you will find examples for almost anything. This one shows how to use the built-in client-side validation with the RadControls for ASP.NET AJAX.

Not Storing the value of silver light control in MS CRM 2011

I have used the silverlight control in CRM 2011.It also published on form but the problem is i am not able to store its value in CRM.In general if we create any field and publish that field in Form then its value will be stored after clicking on Save button.and after that when we open that record,we can see control value that was stored previously.but in my case i published that silver light control on form but after save the record when i click on Record i cant see its value again.means silverlight control value was not going to stored in CRM.I have just simply used the textbox of silverlight...
You will need to call a JavaScript function on your form from Silverlight. Take a look at the HTML Bridge for communicating between the page and Silverlight. There's an example in the MSDN of registering and calling a JavaScript function from Silverlight.
In Silverlight it looks like:
HtmlPage.Window.Invoke("myJSMethod", myParam);

ReCaptcha: cant get it to work in a exisiting modal dialog consuming web service

Community -
I'm stuck for couple days on this and decide to go with a iFrame solution and a regular embedded page with a basic reCaptcha plugin using a Page.IsValid {} on the server functionality.
Basiccaly I have an older WebForm ASP.NET 2.0 clients website with a Modal Dialog implemented using a Ajax/JSON call to a MailSend WebService and now integrating a clients wish having a reCaptcha functionality within the modal dialog gets a pain.
After several trials with some basic code and all over not completed code pieces on several blogs around the net I do give up - I go to create a separate page with a regular send to friend mail form and will call it from the parent page with jQuery in a iFrame.
Did anyone had some more luck consuming a reCaptcha Validate Web Service within a modal dialog without a Postback or without using the iFrame way?
I'm thankful for any idea.
Martin
Allright. Me and my co-worker gave up on validate re-captcha thru web service. We finished the task with a iFrame and a jQuery FancyBox modal dialog solution. It solved our problem and it looks good. But I will come back to do the research and try the first way to solve as well at a later point.

Resources