Archive for November, 2006

ASP.NET 2.0 Validation Controls

November 30th, 2006 by koolb | No Comments | Filed in .NET, ASP.NET, Programming, Web Development

ASP.NET 2.0 has not introduced any new validation controls but MS has enhanced the existing validation controls a lot

Validation Groups

Now you can have multiple form areas on the same page by grouping the controls to be validated by using ValidationGroup property of controls.

This feature supports server side validations too. In Addition Page.Validate() method has been enhanced and GetValidators() method has been added. Specifically Page.Validate(ValidationGroupPropertyValue) and GetValidators(ValidationGroup) makes your life much easier

Focusing Controls

Validation Controls now have SetFocusOnError property to make the control focused in the case of an error. You can also use the Focus() method of server controls which will add client-side JavaScript to set focus to a particular control on page load

Browser compatibility

MS has used document.getElementById(id) in validation controls making client side validation possible in all the browser which supports JavaScript 1.2 or higher. This has make all the controls to be work in IE, Firefox and Opera.

Following are the Base Validation Control Properties from MSDN

ControlToValidate

The programmatic ID of the input control that the validation control will evaluate. If this is not a legitimate ID, an exception is thrown.

Display

The display behavior for the specified validation control. This property can be one of the following values:

None — The validation control is never displayed inline. Use this option when you want to show the error message only in a ValidationSummary control.

Static — The validation control displays an error message if validation fails. Space is allocated on the Web page for the error message even if the input control passes validation. The layout of the page does not change when the validation control displays its error message. Because the page layout is static, multiple validation controls for the same input control must occupy different physical locations on the page.

Dynamic — The validation control displays an error message if validation fails. Space for the error message is allocated dynamically on the page when validation fails. This allows multiple validation controls to share the same physical location on the page.

Note

Because space for the validation control is created dynamically, the physical layout of the page changes. To prevent the page layout from changing when a validation control becomes visible, the HTML element containing the validation control must be sized large enough to accommodate the maximum size of the validation control.

EnableClientScript

Indicates whether client-side validation is enabled. You can disable client-side validation on browsers that support this capability by setting the EnableClientScript property to false.

Enabled

Indicates whether the validation control is enabled. You can prevent the validation control from validating an input control by setting this property to false.

ErrorMessage

The error message to display in the ValidationSummary control if validation fails. If the Text property of the validation control is not set, this text is also displayed in the validation control when validation fails. The ErrorMessage property is commonly used to provide different messages for the validation control and the ValidationSummary control.

Note

This property does not convert special characters to HTML entities. For example, the less than character (<) is not converted to <. This allows you to imbed HTML elements, such as an <img> element, in this property’s value.

ForeColor

Specifies the color in which to display the inline message when validation fails.

IsValid

Indicates whether the input control specified by the ControlToValidate property is determined to be valid.

SetFocusOnError

Indicates whether focus is set to the control specified by the ControlToValidate property when validation fails.

Text

When set, this message is displayed in the validation control when validation fails. If this property is not set, the text specified in the ErrorMessage property is displayed in the control.

ValidationGroup

Specifies the name of the validation group to which this validation control belongs.

ASP.NET 2.0 Problems / Issues with Master Pages

November 29th, 2006 by koolb | No Comments | Filed in Uncategorized

I faced hell of a lot of problems when doing Master Pages. Master Pages will work smoothly as Microsoft says if your application is a very simple and all the files are in the same directory. But if your application is bit complex, where you have to use multiple directories for different user roles etc, then you will have face lot of problems implementing Master Pages.

I was able to solve almost all of the problems by referring to  following posts. So read them and solve your problems too…

http://www.velocityreviews.com/forums/t300671-how-to-link-a-stylesheet-to-a-mastercontent-page.html

http://www.odetocode.com/Articles/450.aspx

Looks Like Macs Crash Too

November 21st, 2006 by koolb | No Comments | Filed in Uncategorized

This is interesting set of video clips from MAC conference.  Seems all are in the same boat :-) ….

ActiveX plug-in from TODO: <File Description> from TODO: <Company name>

November 8th, 2006 by koolb | 2 Comments | Filed in Uncategorized

Do you install an ActiveX plug-in from Unknown publisher? Or if IE says that it’s from TODO: <company name>? Click on the following screenshot to see what I’m taking about.

IE add-on TODO: <File Description> from TODO: <Company name>

Source: tv.yahoo.com
Click on the image to see the message clearly.

This is from non-other than Yahoo. Its good programming practice to put TODO: in your code where you can attend later rather than just keeping them on your mind. But releasing the software without removing them and without checking…..disaster…..

Microsoft and Novel Agreement

November 4th, 2006 by koolb | No Comments | Filed in Uncategorized

Microsoft and Novell have signed a cooperative technology deal on Nov 2nd, which will make it easier for Novell’s Suse Linux distribution and Microsoft Windows to work together.
According to news the Mono (open source version of .NET) is free from possible Microsoft patents.
Check out more on this @ http://www.novell.com/linux/microsoft/

and

Google News