Search 

Look at below progress bars



These don't contain any images. They all are pure JavaScript based progress bars. They uses the JavaScript Timer Class for the delay and jQuery fading function transparency for animated effect.

I have worked on CSLA on few projects and I am very much impressed from all of its features. However not every application wants to use CSLA but may be some features out of it. This post is about adding IsDirty and IsNew capabilities to our object. I used CSLA as reference for create these classes.

JavaScript with Oops is not much used by developers while creating application however we can make our life easy if we use JavaScript with Oops.

Let's started object oriented programming in JavaScript by taking example of a Timer class, similar to the Timer control in windows application.

Create Class

Create the class Timer. Below code shows how to declare the class

// Declaring class "Timer"
var Timer = function()
{
    // ....        
    // Class body
    // ....
}

Lets take a simple example of declaring and raising a custom event. Look at the code below:

public class EventTestClass
{
    public event EventHandler NewEvent;

    protected void OnNewEvent()
    {
        NewEvent(this, EventArgs.Empty);
        // Above code will raise System.NullReferenceException
        // exception if there is no handler registered with it.
    }
}

Creating a form with lots of field could be a tedious task as it involves playing with TR and TD in html table. Along with that it also increases the size and complexity of the html code of out page. e.g. Look at the below form:








A lots of the time you want to add instructions to text box fields of the page to provide usability information to the users. Alternate way of doing this could be using default text in the input fields. A default text is the text which appears in the text box when it is empty. e.g.

Name
Email
Website
Comment

In one of my post, I posted about How to cache a page output in ASP.NET, but sometime you have requirement like the page should never be cached. Every time user request a particular url it should give you fresh version of the page or file. To achieve this simply added Location="None" to the OutputCache directives.

<%@ OutputCache Location="None" VaryByParam="None" %>

Using Location="None" will tell the browser not to cache the page and hence your can prevent the page from saving on temporary internet files on client's machine. This could be useful when you don't want you pages or some particular page to be stored at client side for security reasons.

You might have seen floating content of web sites which is always visible on the page even if you scroll it. This is easy achieve thing by using just CSS. However there is also JavaScript alternative for this but the CSS one is smoother and faster as this doesn't includes any run time calculation. The below step by step process will guide to how to add a always visible div on web page.

We generally use exception and stack trace for tracking down to the problem in our code. But a lots of the time, in case you are not using proper way to throw exceptions then it might make difficult to narrow down the problem. Whenever we throw an exception; it is recorded into the exception stack trace.

Let understand this with an example. Consider the below console application:

This might be an easy trick, but I ran into this issue a while ago; we can not specify the runat="server" attribute on a JavaScript file link as we do for images and style sheet.

<link id="mainSheet" runat="server" href="~/Images/styles.css" 
rel="stylesheet" type="text/css" />

By using runat=server the href of the link will automatically be resolved by the asp.net in we have placed ~/ in the path. This gives us advantages when we are linking this into a control and the control could be used by other pages places at a different directory level.

Same problem arise with using linked JavaScript. But this cannot be solved by using runat=server tag. Here is an alternative way to overcome this problem.

Recently Added

Database

More..
Step by Step Guide to Add a SQL Job in SQL Server 2005

by Daily Coder on Jul 10, 2008
Describes Step by Step process of adding a sql job in SQL Server 2005
3 Comment(s)

Generate New Guid (uniqueidentifier) in SQL Server

by Daily Coder on Jun 19, 2008
About how to generate a random unique identifier in using sql query in SQL server
0 Comment(s)

Add parameterized queries in MySql (OleDb)

by Daily Coder on May 18, 2008
Explains how to add parameters in odbc queries
0 Comment(s)

Design

More..
Layout Form without Tables with CSS Trick

by Daily Coder on Aug 4, 2008
How to design a form without using any table or nested div
11 Comment(s)

Creating always visible div using CSS

by Daily Coder on Jul 29, 2008
Explains how easily we can create an always visible div using very simple CSS trick in html
3 Comment(s)

Add favicon to your web site or html page

by Daily Coder on May 29, 2008
Describes how to install and use a favicon on your website
3 Comment(s)

Apply CSS to html INPUT control based on type attribute

by Daily Coder on May 20, 2008
how we can add css to any input element based on the type attribute of INPUT to control the stylesheet
0 Comment(s)

How to set 100% table height in html

by Daily Coder on May 18, 2008
Explains how to set 100% table height in a html page, a commonly faced problem.
8 Comment(s)

General

More..
Maintaining Dirty and New state of objects

by Daily Coder on Aug 26, 2008
Explains how to manage Dirty, Clean, New and Old state of business objects in you application
0 Comment(s)

Avoiding Event != null Check

by Daily Coder on Aug 7, 2008
Describes about how we can eliminate the repeating check of Event != null every where in code before raising any event
4 Comment(s)

Are You Throwing Exceptions Correctly?

by Daily Coder on Jul 25, 2008
Discuss practices to throw exceptions to intact the exception stack trace
9 Comment(s)

Specifying Access Modifier for Getter and Setter in Property

by Daily Coder on Jun 13, 2008
Explains about how we can have different access modifier for getter and setter in a property
1 Comment(s)

Using Thread Pool for Multi-Threading application

by Daily Coder on Jun 9, 2008
How to use thread pool for multithreading in a .net application
0 Comment(s)

Others

More..
MIME content-types with file extension

by Daily Coder on Jul 15, 2008
List of MIME content-types and their file extension
0 Comment(s)

Links - Jun 02, 2008

by Daily Coder on Jun 2, 2008
Some good links about web site design and development
0 Comment(s)

Scripting

More..
Animated Progress Bar without Images

by Daily Coder on Sep 3, 2008
How to create a cool looking animated progress bar without using any images using javascript, css and html
3 Comment(s)

Object Oriented Programming with JavaScript : Timer Class

by Daily Coder on Aug 13, 2008
How to do object oriented programming with JavaScript by taking simple example to a timer class.
0 Comment(s)

"Default Text" Fields Using Simple jQuery Trick

by Daily Coder on Aug 1, 2008
Explains how to implement default text input field using simple jQuery trick
7 Comment(s)

Variadic Functions in JavaScript

by Daily Coder on Jun 26, 2008
Create and use function with indefinite number of parameters in javascript
1 Comment(s)

Using RegEx(Regular Expressions) in JavaScript

by Daily Coder on May 28, 2008
using javascript to create and verify user's input by using regular expression at client side
0 Comment(s)

Web

More..
How not to cache a page output in ASP.NET

by Daily Coder on Jul 31, 2008
Explains how not to cache pages in asp.net to avoid them stored at client side
2 Comment(s)

The Script tag runat="server" Problem Solution Using ResolveUrl

by Daily Coder on Jul 21, 2008
Solution to the script tag runat="server" problem
0 Comment(s)

How to force a file to download in ASP.NET

by Daily Coder on Jun 16, 2008
This article is about how we can force the user to dowload a particlar file or file type by adding the content-disposition header
2 Comment(s)

Implementing Cookieless Session (ASP.NET)

by Daily Coder on May 27, 2008
Explains how to implement cookieless authentication in asp.net by settings in web.config
0 Comment(s)

Create RSS feed programatically from data in C#

by Daily Coder on May 24, 2008
This article will explain how can you to create you own utility to generate rss feed from yous data programatically
2 Comment(s)

Windows

More..
Using Microsoft Agent in Windows .Net Application

by Daily Coder on Jul 4, 2008
How to use and animate MS in .NET Applications
0 Comment(s)

Using Invoke to access object in a windows forms/controls thread

by Daily Coder on May 26, 2008
How to use Invoke to handle cross thread calls to windows forms or controls
0 Comment(s)

How to crawl a web page/file in a .net application

by Daily Coder on May 23, 2008
Explains how we can crawl a web page or file using a virtual path and store the response locally
0 Comment(s)

How to get current assembly version

by Daily Coder on May 21, 2008
Extracting the version of currently executing assembly
0 Comment(s)

More..

Contact

For any help or queries contact me sa@dailycoding.com
© Copyright 2008 Daily Coding • All rights reserved