Monday, April 22, 2013

ASP.Net MVC 3 jQuery Remote Validation - Some Gotchas

If you have a requirement where you need to validate few fields on the fly , like creating a unique username, you might find remote validation concept quite handy.

There is a good explanation (with example) here

There are several small issues you might run into when using Remote Validation concept in ASP.Net MVC3
1. Validator called twice
This generally happens if you have the script maintained at the page level and master (layout) page, then there is a chance that validation would be called twice. Remove the script reference from either of the places.
2. Validation happening on every keypress, but you would like to have it on blur (lost focus i.e.)
This can be handled by disabling the keyup for validator globally as shown below

$(document).ready(function () {
    $.validator.setDefaults({onkeyup: false})


Wednesday, July 11, 2012

Using Fiddler with soapUI

As developers, Fiddler is one tool which helps a lot when it comes to tricky requests, response. Similarly soapUI is an excellent tool which helps you work with service calls interactively. Recently I was facing an issue within a particular service call from soapUI and when I tried to findout the response from Fiddler, I was surprise that it was not captured at all (despite of being remote service).

The reason why it happens is that Fiddler by default listens port 8888 on (You can verify this using  Tools > Fiddler Options > Connections). When the requests are being made from browsers etc, then this gets used correctly. In case of soapUI this needs to be explicitly configured.

To configure it in soapUI, goto File Menu in soapUI and select Preferences. Then select "Proxy Settings" tab and on the right side, enter values as

PORT: 8888

And do select the "Enable proxy" checkbox. Apply and now re-run the request. Now onwards all requests from soapUI would be tracked appropriately in Fiddler as well.

Wednesday, March 2, 2011

Crystal Reports with Visual Studio

Recently I was trying to work with Crystal Reports for learning purpose and I have ran through couple of issues. Solutions to these issues were trivial but took good amount of time in research.

It goes without saying that you should have a valid installation of Visual Studio with crystal report basic and valid license on the server for running crystal reports.

Issue No. 1 - Can't see images for Crystal report viewer, or not able to use the export, print functionalities when deployed to another web server.

Solution : This happens because crystal repots viewer assumes a very specific directory structure for the images and scripts. If you are running IIS on your development machine, you can find the structure here "C:\inetpub\wwwroot\aspnet_client\System_Web\2_0_50727\CrystalReportWebFormViewer4"

Now all you have to do is that copy the content of this whole structure, right from aspnet_client to your webserver and create a virtual directory to point to this path. Even if you dont want to create a virtual directory or dont have access to do so, you can simply copy the full structure to the root of your webapp and that should do the magic.

If you are not using IIS and using a inbuilt webserver with Visual studio (cassini i.e.), still you will have this structure , only thing that in this case it would be available at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles

Inserting code in blogger was never so easy

I have always struggle for inserting code in my blog.
//Now it seems to be easy
Many thanks to him for sharing the knowledge