Thursday, August 8, 2013

AjaxControlToolkit with Visual Studio 2012

So, I tried today to create a new Web Site using the Visual Studio 2012 Template. I then proceeded into adding AjaxControlToolkit using the NuGet package.

Once I deployed (or debugged) the project, I kept getting the following script error:

        AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts.

After scouring the internet for a cause, I came across this blog post from Tim, I successfully managed to use the Toolkit without any errors. The steps someone needs to follow are:
  1. Install the AjaxControlToolkit. I did this using the "Manage NuGet Packages" menu option, since it also easily resolves the package dependencies.
  2. Replace the <asp:ScriptManager> tag in the Site.Master page with <ajaxToolkit:ToolScriptManager>
  3. Remove the MsAjaxBundle ScriptReference tag.
  4. Remove the Assembly="System.Web" attribute from all the ScriptReference tags.
  5. Remove the Microsoft.AspNet.ScriptManager.MSAjax reference. This is not visible through the references, so you need to do this either using the "Manage NuGet Packages" menu option or using the NuGet Command Line interface, and entering Uninstall-Package Microsoft.AspNet.ScriptManager.MSAjax
That's it! Your project, including all the fancy AJAX controls you can add using the AjaxControlToolkit, will now work perfectly.

P.S. If the problem persists, you will need to go and manually delete the Microsoft.AspNet.ScriptManager.MSAjax.dll file from your output folder. After this, no problems should occur.

Wednesday, August 25, 2010

Dynamic Treeview using XML

I've been dealing quite a lot with WPF, but here is an interesting solution for ASP.Net.

I wanted a dynamic TreeView control to act as my navigation for a Web Application. The whole idea was to expose the links/items to a user only if she had permissions to view the page. Permissions are set via an other custom Web Application. Basically, each page has a PermissionId and each User is bound to a Role that has (or not) permission to a page.

Tuesday, August 24, 2010

Animation in WPF

One of the coolest things about WPF is the animation power it has. WPF has moved past the old Win32 and GDI/GDI+ libraries and instead uses DirectX. This allows for more powerful animation and graphics.

The thing to remember though is in order to have a nice looking animation, it should not lock the UI while running. If it does, you probably won't have a chance to see the animation happen!

So, here is a small sample of how to do this:

Monday, August 23, 2010

Creating Custom Formatters for WPF ListView

In the previous post I showed how you can create and bind a ListView using LINQ. Now, if you want to format a value in one of the columns, one way to go around this is using StringFormat. Here is a very good blog entry explaining this.

StringFormat however allows for mostly basic formatting. What if you want to do something more complicated?

As an example, and since I am from Cyprus, I wanted to format an Amount column to display as currency but with the Euro symbol.

Friday, August 20, 2010

WPF ListView and LINQ

After dealing with traditional WinForms DataGridViews, when you are trying to display information, I find that ListView in WPF is much more easy to code.

Friday, April 23, 2010

Troubles in ToggleButton land - 2nd take

As I continued my investigation of the ToggleButton issue mentioned in my previous post, I discovered that if you set the Focusable property of each ToggleButton, the border left on the pressed button when pressing any of the other buttons disappears. 

The issue though with this approach is that the ToggleButton may no longer be selected using the keyboard Tab button. If this is acceptable in your project, then this is a great way to solve the issue.


Again, this issue is reproduced on Windows 7 machines. I'll investigate if this holds for Windows Vista/XP machines. If not, I might submit a bug report.

Thursday, April 22, 2010

Troubles in ToggleButton land

I was recently developing an application in WPF that uses a TabControl control as a ribbon-style navigation bar. I wanted the user to press a ToggleButton and a Frame control at the bottom of the Window would load the requested Page.

Since the TabControl would serve as a navigation bar, I wanted the user to visually be able to see which page was loaded by having the ToggleButton in a Pressed state.
So far so well. When pressing the ToggleButton it remained pressed (as it should).

Now, I wanted when the user pressed a different button, the previously pressed button to go to the Default state. Alas, when the new button was pressed, the previous button was in the Default state, but there was a highlight rectangle around it.