Disable Client Side validation on a button click – ASP.NET MVC

September 16, 2013 .NET, .NET Framework, ASP.NET, ASP.NET 4.5, ASP.NET MVC, Back-2-Bascis, Codes, JavaScript, jQuery, Microsoft, Snippets, VisualStudio, VS2010, VS2012 No comments

ASP.NET MVC we use client side validation using jQuery.validate plugin, which will be based on Model – Data Annotation validation attributes.

In some cases we might want to disable such validation on a button click wherever it is not needed.

For example:

The below code block will register validation block for Title property in the Model, will result in client side validations fired when user click on button.

<div class="editor-field">
          @Html.EditorFor(model => model.Title)
          @Html.ValidationMessageFor(model => model.Title)
<input type="submit" name="backButton" value="Back" title="Go back to Prev step." /> 

We can disable the client side validation check for a button using the β€œdisableValidation=true” attribute for the button.

<script type="text/javascript">
  document.getElementById("backButton").disableValidation = true;


<input type="submit" name="backButton" value="Back" 
 title="Go back to Prev Step" disableValidation="true" />


You disable client-side validation on a button by adding the css style class “cancel” to it.

That will look like below example:

<input type="submit" name="backButton" value="Back"
 title="Go back to Prev Step" class="mybtn-style cancel" />

These are the different ways you can disable the client side validations. Hope it was helpful.

Apple Push Notifications Service API & C#

July 6, 2011 .NET, All, C#.NET, Codes, General, KnowledgeBase, Microsoft, Snippets No comments

To start with Apple Push notifications I would have to first explain what is Push Notifications?

In normal mobiles Push services are often based on information preferences expressed in advance. This is called a publish/subscribe model. A client might "subscribe" to various information "channels". Whenever new content is available on one of those channels, the server would push that information out to the user. For Example: the “Mobile Network location” displayed on your mobile, which keeps on changing based on the tower you are connected.

Push notification allows an application to notify you of new messages or events without the need to actually open the application, similar to how a text message will make a sound and pop up on your screen. This is a great way for apps to interact with us in the background, whether it be a game notifying us of some event occurring in our game world or simply the iPad’s mail application beeping as a new message appears in our inbox.

In addition to pushing messages to the screen, push notification allows apps to display a number or ‘badge’ on the app’s icon. For example, the Mail icon will show the number four when we have four unread messages.

The Apple Push Notification Service is a mobile service created by Apple Inc. that was released with iOS 3.0 on June 17, 2009. It uses push technology through a constantly-open IP connection to forward notifications from the servers of third party applications to the iPhone, iPod Touch and iPad; such notifications may include badges, sounds or custom text alerts.

This is a small information quoted from Apple

Apple Push Notification Service requires iOS 3.0 or later and a connection to the Internet, either via a cellular data network or Wi-Fi, and at least one application that supports notifications.

  • If the Settings > Notifications menu does not appear on your device, you don’t have an application installed that supports notifications.
  • You need to open an application at least once to get any notifications from that app.
  • When the iPod touch screen is on and has a Wi-Fi connection, push notifications are received at any time. If the iPod touch screen is asleep, it will check every 15 minutes for a notification.
  • If you want to disable notifications from an application, turn off all notifications for that application in Settings > Notifications.
  • When you restore a backup to a different iPhone or iPod touch, apps will need to be opened again to get notifications.
  • If the device is connected over Wi-Fi and is still unable to receive notifications, the Wi-Fi network you’re using might have a firewall that is blocking port 5223. This port must be open to TCP traffic for notifications to work.

Few days before writing this article I was in an assumption that since iOS is a closed platform, we cannot utilize other java/.NET server components to make calls to Apple Push notifications API. But recent explorations I figured out we can send out push notifications with help of .NET Library (APNS Sharp), read more on my previous article Sending Apple iOS Push notifications using C# . I successfully tested this in iPhone 3G, by sending push notifications from a .NET application.


Apple has provided two gateway interfaces, one for development/sandbox and another for production use.

Production environment is available through, port 2195 ; the binary interface of the sandbox (development) environment is available through, port 2195.

.. keep reading more on Local and Push Notification Programming Guide


Quick Note: Make sure your port 2195 is not blocked by your firewall, incase you are getting issues.