Microsoft has recently released the guidelines for developing composite WPF and Silverlight applications. The guidelines are supported with sample source code and documentation. The Composite Application Guidance for WPF and Silverlight is designed to help you more easily build enterprise-level Windows Presentation Foundation (WPF) and Silverlight client applications. It will help you design loosely coupled, independently evolvable pieces that work together in the overall application.
The guidance includes a reference implementation, reusable library code (named the Composite Application Library), documentation, QuickStart tutorials, and hands-on labs.
You can download the guidelines here.
Thursday, February 19, 2009
Guidelines on developing WPF and Silverlight Applications
Posted by Sandeep Aparajit at 11:38 PM 0 comments
Labels: Misc
Wednesday, February 18, 2009
How to use <asp:chart> Chart Control in ASP.NET
Microsoft has released the Free Chart Controls (which are based on the Dundas Chart Controls). Chart and graphs play an important role when modeling and analyzing the data. These chart controls provide rich user experience with a wide variety of advance functionality such as drill down charts, Click events on charts and it's components etc. Another best thing is it works fine with ASP.NET MVC. You can find the screen shots of these rich controls below:
Download links for the ASP.NET Charts:
* Download the Free Microsoft Chart Controls
* Download the VS 2008 Tool Support for the Chart Controls
* Download the Microsoft Chart Controls Samples
* Download the Microsoft Chart Controls Documentation
Steps to make it work:
Edit the Web.Config
To enable the controls you have to edit the web.config file.
Add this under the controls tag (path: "<system.web><pages><controls>") :
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
And add this httpHandler (under "<httphandlers>") :
<add path="ChartImg.axd" verb="GET,HEAD"You are set to Go!!!
type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler,
System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" validate="false"/>
Hope this helps you!
Posted by Sandeep Aparajit at 7:20 AM 0 comments
Labels: ASP.NET , How to...?
Ajax "Processing" modal window with CSS
Ajax Processing Panel
<asp:UpdatePanel ID="updateGrid" runat="server" ChildrenAsTriggers="true"The CSS Class are given below:
UpdateMode="Conditional">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="updateGrid"
runat="server" DynamicLayout="true" DisplayAfter="0">
<ProgressTemplate>
<asp:Panel ID="pnlAjaxProcessing" CssClass="ajaxProcessingContainerDiv"
runat="server">
<table class="ajaxProcesingTable">
<tr>
<td class="ajaxProcesingImageTD">
<br />
<asp:Image ID="imgProgressBar" ImageUrl="~/Images/ajaximage.gif"
runat="server" />
<br />
</td>
</tr>
<tr>
<td class="ajaxProcesingTextTD">
Processing...
<br />
</td>
</tr>
</table>
</asp:Panel>
</ProgressTemplate>
</asp:UpdateProgress>
...
...
...
</ContentTemplate>
</asp:UpdatePanel>
.ajaxProcessingContainerDiv
{
border: 0;
height: 10%;
width: 20%;
position: fixed;
_position: absolute;
left: 40%;
top: 40%;
color: black;
z-index: 100;
}
.ajaxProcesingTable
{
width :100%;
height: 100%;
border: 1px solid LightBlue;
background-color : White;
}
.ajaxProcesingImageTD
{
text-align :center ;
}
.ajaxProcesingTextTD
{
text-align :center;
color: #0067a2;
font-size :medium;
}
Hope this helps!
Posted by Sandeep Aparajit at 7:20 AM 0 comments
Sunday, February 1, 2009
Exception handling in Ajax
Exception handling plays an important role in any application development. The way we present our exceptions to the user decides the quality of our software. The way we design a pattern for exception handling in C#, ASP.NET we should also design a similar pattern for implementing Ajax exceptions. If an Ajax exception is not caught, then it should as a pop-up directly on the screen showing the exact technical error message with a code. A layman/user will never know what went wrong behind the scene.
Different ways of handling exception in Ajax
1. Using the AsyncPostBackErrorMessage property of the Script Manager class
You can set the exception message that needs to be shown to the user to the AsyncPostBackErrorMessage property of the ScriptManager object. This can be achieved in the following way:
scriptManager.AsyncPostBackErrorMessage = "Oops..\nAn error occurred while processing";
Set the above exception message in the catch block of the method. When an exception occurs, this message will be shown to the user in a pop-up window.
2. Using the above method will show the exception message to the user as a pop-up window. It is not a good practice to show a pop-up on error. Better way to do is to add a Label field to the web page and set the text of that label field with the exception message. For more clarity to the user, the exception message can be shown in Red color. Ajax inherently exposes an event OnAsyncPostBackErrorHandler. This event is invoked when an exception occurs in your web page. It is better to set the exception message in this event as shown below:
protected void OnAsyncPostBackErrorHandler(object sender, AsyncPostBackErrorEventArgs e)Is this going to suffice? The answer it NO. Here we have just handled an event and set the required exception message to the AsyncPostBackErrorMessage property of the scriptManager class. We have to handle another event at client side to set this message to the Label control and inform the Ajax manager to not show the ugly pop-up. Following code will be inserted at the client side:
{
scriptManager.AsyncPostBackErrorMessage = "Oops..\nAn error occurred while processing";
}
<script language="javascript" type="text/javascript">Hope this helps. Your comments are welcome!
// Register the EndRequest Ajax event
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
// Here the Ajax EndRequest event is used to supress any ALERT error message and
// show them in the lblStatus instead.
function EndRequestHandler(sender, args) {
if (args.get_error()) {
var msg = args.get_error().description;
msg = msg.replace('Sys.WebForms.PageRequestManagerTimeoutException:', '');
msg = msg.replace('Sys.Webforms.PageRequestManagerServerErrorException:', '');
document.getElementById('ctl00_mainPlaceHolder_lblStatus').innerText = msg;
// This will avoid the pop-up
args.set_errorHandled(true);
}
}
</script>
Posted by Sandeep Aparajit at 11:44 PM 0 comments
Labels: Ajax