Posted by: sapnakirti | September 23, 2008

Integrating Ajax with MOSS 2007

In this post I’m going to explain how to start using ajax in your web parts. The goal of this article is to reproduce functionality similar to the KPI and BDC web parts in MOSS 2007.

Introduction
I am going to show you how to integrate ASP.NET Ajax 1.0 with MOSS 2007. I will create a new Ajax WebPart from scratch and then deploy it into MOSS 2007 site. Moreover, I will demonstrate how to add that webpart into SharePoint Page.

Building Webpart DLL Project
To create a web part, open your visual studio, create new “Proejct“, Select “SharePoint” from “Project Types” and select “Web Part” from Templates. Give the name of Web Part “AjaxSample” in “Name” Field. Then Press “OK“.
Now you can see the code window like :

Now Add the reference for Ajax DLL :
Open Solution Explorer – Right click on “References” and select the “AjaxControlToolkit.dll” from your desired location where you have stored it. After adding the required references your solution explorer will have the look , like

Now its time to extend web.config with some settings to enable ASP.NET AJAX technology.

Extending SharePoint web.config files with ASP.NET AJAX requires that you interleave some Ajax registration entries in-line with WSS registration entries.
To do this you will need to edit your SharePoint web.config file.

1. Add a “sectionGroup” element to the “configSections” tag:

2. Add a “controls” section as a child of the “system.web” “pages” tag.

3. Add the following tag to the tag, within :

4. Add some new registrations to the end of the section:

5. Add a new registration to the HttpModules section, beneath any existing registrations.

6. Add a SafeControl entry for the System.Web.UI namespace from Microsoft Ajax Extensions, within the section:

7. Finally, add the following configuration tags at the bottom of web.config, near the bottom before the end tag.

8. Now add references:

using System;
using System.Collections;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI;

9. Take two controls Label and TextBox :

private Label label;

private TextBox textBox;

10. Now create CreateChildControls() Method:

11. Write below line of code in Button’s Click event:

this.label.Text = “Hello ” + this.textBox.Text;

12. Now add one method  EnsureUpdatePanelFixups() :

13. Now add the ScriptManager in your Web Part :

Define the Script Manager like :

protected ScriptManager SM;

14. Then put below code in the beginning of CreateChildControl() Method:

15. Now deploy the Web Part in your SharePoint Site.

Posted by: sapnakirti | September 22, 2008

How to implement LIVE Chat

Its an feature of Windows Live Messenger.
It enables you to add a Web based messenger to your Site Blog or any Share Point Site.

To create this yourself visit :
http://settings.messenger.live.com/applications/websettings.aspx

Steps for how to integrate it?

(1) Go to the site :http://settings.messenger.live.com/applications/WebSettings.aspx

(2) you will see a setting for “Manage your Messenger web settings”

The check box ” Allow anyone on the web to see my presence and send me messages.”
It will allow any one to message you from any chat gadget.

Now Click on “Create HTML” link which is at left side of the page.
OR
You can directly get the HTML code from this link :
http://settings.messenger.live.com/applications/CreateHtml.aspx

At the bottom you will find these instructions.
” Copy the HTML and paste it into your webpage”

Now to make available this Gadget in your site , Open your sharepoint page in browser.
Drag and Place a ContentEditorWebPart there.
In it’s Source Editor, Past the HTML Code that you have copied.

Done!!!
Now any one can chat with you by using this.
You have to make login in MSN Messenger.

Categories