Thursday, July 29, 2010

IZWebFileManager 2.6 release is out

Welcome the new generation of IZWebFileManager - v2.6

What's new?

1. Multiple files upload.
File upload bar allows you to select more then one file to upload at once.



I added two new resource keys to support localization:

Upload_Another_File - default value "Upload Another File", text of the link bellow the browse file box.

Upload_File_Remove - default value "Remove", text of the link near to each of browse file boxes.

To enable localization of this texts just add a proper resources to WebFileManagerResource.XXX.resx suitable you locale.

2. Upgraded to VS 2010/.NET 3.5.
Since this release using of IZWebFileManager requires .NET 3.5 or higher.

The release is available for download from Google Code
https://code.google.com/p/izwebfilemanager/

What's next?

In current implementation I use reflection to access some not public API. That causes application fail when run in Medium trust environment. (http://www.izwebfilemanager.com/forums/thread/543.aspx)

So, in the next release I will solve this problem.

Thanks for support!

Thursday, July 22, 2010

HtmlTextWriter fluent interface

When working on new features in IZWebFileManager I needed to change rendered HTML.

I took a look at the code I wrote more then 3 years ago.... It is so complicated!

IZWebFileManager is a typical custom control that overrides Render and uses HtmlTextWriter's API to produce HTML. Here is a small part of the rendering flow:



It took me a while to figure out what is HTML is rendered here.
The fact is, that HtmlTextWriter's API is not intuitive and requires a lot of effort to produce relatively simple HTML. Is there a alternative way to render output?

WhenLINQ has been released all the .NET world has met fluent APIs, and I was wandering if there is such an API for rendering ASP.NET controls.

I found this one: http://csharpfeeds.com/post/9989/HtmlTextWriter_fluent_interface.aspx

I've just added it to my project (made it internal to prevent collisions), changed it a bit and rewrote the code above:



Now it is much easier to change the rendered HTML, because this code flow is much closer to the HTML markup flow, than when it was written using the "classic" HtmlTextWriter API.

Wednesday, June 30, 2010

IZWebFileManager 2.5.4 release is out

I am very happy to announce that IZWebFileManager 2.5.4 has been released.

From now (and forever) it supports Chrome, Safari and Opera browsers.
You are welcome to try it using online demo:
http://www.izwebfilemanager.com/demo/default.aspx

The release is available for download from Google Code
https://code.google.com/p/izwebfilemanager/

Cheers!

Wednesday, June 2, 2010

Build .NET Project with NAnt

Since NAnt comes with NAnt 0.90 release I was interested to use it with my project IZWebFileManage.

At first look it is powerful tool allows me easy to build project, run tests and package release.

The first task was"build" of course.

For such purpose NAnt offers <csc> task, but using this task I have to declare output type, list of source files, resources etc. It is quite good if you are using Notepad or any other (not Visual Studio) IDE, but I (and I believe most of .NET developers) use Visual Studio and have *.csproj file.

Is there a way to build VS project with NAnt? Yes, you may find it in NAntContrib. It provides <msbuild> task. But problem is that NAntContrib is quite out of date. The last release is on 2006/10/15 and I am not sure it supports NAnt 0.90 and VS 2008

Is there alternative way to build *.csproj? Yes - msbuild command line!
NAnt has <exec> task which run any command line you want.

There is my Default.build file:



<?xml version="1.0" ?>
<project name="IZWebFileManager" default="build"
xmlns
="http://nant.sf.net/schemas/nant.xsd">

<property name="project.config" value="Debug" />

<target name="clean">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline='/t:Clean /p:Configuration=${project.config} /p:Platform="AnyCPU" /v:n'
workingdir="." />
</target>

<target name="version">
</target>

<target name="build" depends="clean, version">
<exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
commandline='/t:Build /p:Configuration=${project.config} /p:Platform="AnyCPU" /v:n'
workingdir="." />
</target>

</project>

I place Default.build file near to *.csproj file and msbuild find it by default, so there is no need to mention name of project file explicitly.

Run build using command line:

>nant build


P.S. After a while I figured out <solution> task. Looks like that is what I need to run msbuild with NAnt. I will discover it...

Monday, May 17, 2010

ASP.NET MVC 2 Client side validation using jQuery validation plug-in

ASP.NET MVC 2 has validation architecture that support both server-side and client-side validation. ScottGu describes in details how to get validation works in his post ASP.NET MVC 2: Model Validation.

The best feature in client-side architecture is that you may use alternative java scripts validation libraries like jQuery validation.

There are a steps to get client-side validation works using jQuery validation plug-in:

  1. Download and add to your ASP.NET MVC project following java scripts:
    I assume you put all scripts into /Scripts folder of your MVC application
  2. Enable client side validation
    • add three JavaScript references to your view

    • write one line of code in the view before form
That's it! Now you have Client-side validation using jQuery validation plug-in!

Thursday, April 29, 2010

S#arp Arcitecture 1.5 - running T4 teplate error

I decided to build some project using S#arp Architecture. I am using VS 2010.

I went through all installation steps and created my first project S#arp Architecture Application.

My next step was running scaffolding generator. And then I got the troubles.

Any time I run custom tool, I get two error messages:

Compiling transformation: Metadata file 'Inflector.Net.dll' could not be found
Compiling transformation: Metadata file 'SharpArch.Core.dll' could not be found

I checked the references - they was set correctly. I was stuck but I didn't want to surrender, and after hours of googling and voodoo I got the solution.

The problem is solved by specifying the absolute path to the referenced assembly in template file (@assembly directive)

I found two files where Inflector.Net.dll and SharpArch.Core.dll are referenced:

[solution folder]\tools\CrudScaffolding\EntityScaffoldingDetails.tt
[solution folder]\tools\CrudScaffolding\Templates\BaseTemplate.tt

and replaced following rows

<#@ assembly name="SharpArch.Core.dll" #>

with

<#@ assembly name="[solution folder]\lib\SharpArch.Core.dll" #>

and

<#@ assembly name="Inflector.Net.dll" #>

with

<#@ assembly name="[solution folder]\lib\Inflector.Net.dll" #>


No error anymore!

Saturday, March 13, 2010

IZWebFileManager 2.5.3 has been released

IZWebFileManager 2.5.3 has been released

It includes:
* Thumbnail view fix (http://www.izwebfilemanager.com/forums/thread/445.aspx)
* New Netherlands/Dutch translation (by Marcel van den Arend)

The release is available for download from Google Code
https://code.google.com/p/izwebfilemanager/

Cheers!