Showing posts with label Sharepoint. Show all posts
Showing posts with label Sharepoint. Show all posts

Thursday, October 9, 2008

ASP.NET AJAX 3.5 and AjaxControlToolkit with SharePoint

Enabling Ajax in the SharePoint application was the challenge for the developers. But now technology is difference and life is more easier . Now you can use ASP.NET Ajax extension features inside the SahrePoint

How to :

1.) Follow the instructions in the following SharePoint Team Blog post:

Integrating ASP.NET AJAX with SharePoint

2.) Add th
e following assembly bindings to your SharePoint web.config. (This will redirect your AJAX 1.1 assemblies to use AJAX 3.5.)

2.) Add the following assembly bindings to your SharePoint web.config. (This will redirect your AJAX 1.1 assemblies to use AJAX 3.5.)



<configuration >
<runtime >
<assemblyBinding >
<dependentAssembly >
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/ >
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/ >
</dependentAssembly >
<dependentAssembly >
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/ >
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/ >
</dependentAssembly >
</assemblyBinding >
</runtime >
</configuration >



Keep this link also in mind http://daniellarson.spaces.live.com/


Happy coding .............

Thursday, June 5, 2008

SPItemEventReceiver.ItemUpdating + Redirecting to Custom Page

This shows How redirecting to new page inside the SPItemEventReceiver.ItemUpdating event.


class CustomEventHandler: SPItemEventReceiver {

private HttpContext currentContext = null;

public CustomEventHandler()
: base()
{
if (null != HttpContext.Current)
{
currentContext = HttpContext.Current;
}
}

public override void ItemUpdating(SPItemEventProperties properties)
{
SPSite siteColl = new SPSite(properties.SiteId);
SPWeb site = siteColl.OpenWeb(properties.RelativeWebUrl);
SPList list = site.Lists[properties.ListId];

// Add the item and fill it with the values from properties
DisableEventFiring();
SPListItem itemToUpdate = properties.ListItem;
this.CloneItem(itemToUpdate, properties);


itemToUpdate.update();
EnableEventFiring();

SPUtility.Redirect(site.Url + "/ThankYou.aspx",
SPRedirectFlags.Default, currentContext);

site.Dispose();
siteColl.Dispose();
}
}
}

Note : You can only redirect inside the ItemAdding, ItemUpdating,ItemDeleting events only. Becuae in ItemAdded , ItemDeleted and ItemUpdated context is null.