Friday, September 23, 2011

Adding Attachment Toolbar button to HTML Editor

Requirement
Recently, I was working on a project (ASP.NET) where there was a need to allow business users to design their own html page with some basic html features. In addition they also wanted to add some logo and attachments to their html.


Possible Solution
- Somebody suggested to use sharepoint features, which has lots in inbuilt functionality to manage contents. I did not take this approach because of sharepoint environment management point of view. Its a whole different world to manage. I wanted to keep my solution simple
- Another approach was to bye some html editor product which gives all functionality you need. We did not want to spend money to buy any product on this
- Use AjaxControlToolkit HtmlEditor which gives all basic features and enhance it to add new toolbar button to add attachments and logo. This is the approach we went for.

Solution
Solution basically uses-
1) .NET 4 framework
2) AjaxControlToolkit HtmlEditor
3)  AjaxControlToolkit AsyncFileUpload control
4) jquery ui plug in

The basic design involves of
  • Creating a class for your new htmleditor called (MyHtmlEditor.cs) and extend it from ajaxcontroltoolkit htmleditor class.
  • Override its FillToolBar method to add your new toolbar button
  • Create a new class for your new tool bar button and extend it from MethodButton
  • Override few methods and properties
  • Use embedded resource for toolbar icon, client scipts, so that you can reuse your library anywhere you want
  • You can implement your upload complete event in the way you want, you can save it to database or local server.

You can download the code from the following location

Code to Download














Tuesday, January 11, 2011

Ignoring SQL Stored Procedure result in BizTalk Send port

Problem
Recently one of my colleague asked me a question about the SQL Stored procedure execution in BizTalk Server 2010. His requirement was to ignore the SQL SP results including the returnStatus of the SP, however by default it does not happen. WCF SQL Adaptor expect a subscription to be in place for response of SP for a successful transaction, and incase of its absence sql adaptor transaction fails.
Cause
Why this happens? When you auto generate schemas for a stored procedure using Add Generated Items -> Consume Adaptor Service, the wizard create request response schema of the SPs as shown below.



and a binding file called as "WcfSendPort_SqlAdapterBinding_Custom.bindinginfo.xml"
The binding generated by the wizard is always for two way send port. This is the reason it always expect to have a subscription of the response message.

Solution
The solution to above problem is simple with BizTalk Server 2010 compared to earlier version of it. You can modify the autogenerated binding as follows:
1) set IsTwoWay to "false"
2) comment out "receivepipeline" and "receivepipelinedata" section
Once binding is imported with these changes, send port will be created as one way and it will not expect to have a subscription of response message.
This solution is very well documented on microsoft web site
http://msdn.microsoft.com/en-us/library/dd788154(v=bts.70).aspx.

Sunday, January 9, 2011

BAM Portal Configuration Error on Windows 7

Problem
Recently, I was configuring BizTalk Server 2010 on Windows 7 64bit machine. I encountered an issue while configuring BAM portal on IIS7.

The error you get is "The web site Default web site is not valid"
Cause
IIS7 causes this issue as with default installation mode, BAM portal can not be configured on IIS7.
Solution
In order to solve the issue, you need to switch on the IIS6 Management Compatibility on your machine using following option:
Control Panal -> Programs -> Turn Windows Features on or off -> Internet Information Services as shown below:



Once this is done, BAM portal will be configured without any issue.