04 February, 2014

Workaround for Visibility.Hidden in Silverlight

I love working on XAML/Silverlight and I don't face any issues most of the times. But when I am in trouble, I don't find any clue on how to come out of that. Recently, I am working on a Silverlight application and got a requirement to apply background color for Items which contains Collapsible Controls. To Understand this properly, I have a list of CheckBoxes with TextBox Controls and the TextBox should only be visible on CheckBox Check. To accomplish this, I simply Binded the Visibility of TextBox with IsChecked Property and thats working like charm.

The problem is when I apply BackgroundColor to those Items. If I apply a BackgroundColor to ListItem in Template, It is taking only till CheckBox content, if there is no TextBox (i.e., CheckBox is Unchecked).
Now I came to know the importance of Hidden in the Visibility Values. But soon I found that its not supported in Silverlight.
The only work around for this is to manipulate Opacity of the TextBox instead of Visibility. This fulfilled my requirement and hope works in all the situations. I haven't tested for TabStop, HitVisibility, ScreenReaders as they are out of scope in our project. The Final Binding will look like following:

08 January, 2011

Un Installing SQL Server Reporting Server 2005 - The setup failed to read IIsMimeMap table. The error code is -2147023550

I have been facing a severe issue when i try to install SQL Server 2005. SQL Reporting server is already installed in my system and I need to un-install that first and Install SQL Server again.
When I try to un-install Reporting server i got this error:

The setup failed to read IIsMimeMap table. The error code is -2147023550.

I spent a day to resolve this issue and finally i found a link to do the same. IIS Admin service is the culprit, which needs to be stopped before un-installing the Reporting server.

If you face the same issue, plz follow the steps.
1) Stop IIS Admin Service
2) Stop IIS
3) Uninstall SQL Server Reporting services.

These steps will work like charm and thanks to friend, who helped me in this regard.

16 September, 2010

Complete use of RequiredFieldValidator

It's very common to use asp:RequiredFieldValidator to validate form data before submission. Using this for a TextBox is very straight forward, but Today, I came to know that the same can be used effectively to validate asp:DropDownList and asp:RadioButtonsList too. Lets know, how this can be done.

First of all, the usage depends on the Binding of List Items. If all the Items are static and added with <asp:ListItem> as below

<asp:DropDownList ID="ddlAddress" Width="150" runat="server">

Here first item is optional and used for DropDownList in general. Now, the RequiredFieldValidator for this dropdownlist will be as following:
<asp:RequiredFieldValidator ID="rfvaAddress" InitialValue="0" ControlToValidate="ddlAddress" runat="server" ErrorMessage="*" CssClass="Note" />
Here InitialValue is an optional property which is used to mention the Item, which should be selected by default.

But in general the dropdowns are binded in code-behind. If we have an initial item with select text, the value for that select item should be string.Empty. If you don't have this default item, the first item will be selected by default and there is no use of RequiredFieldValidator.

10 August, 2010

Flash Detection Javascript

This is the simple javascript code to detect whether flash installed on the machine or not!

//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's
//running on a platform other than Mac or Windows 3.1) or a browser that supports
//the plugin property of the navigator object and that has Flash Player 2.0
//The Check for Internet Explorer is needed as it can play native swf files.

var flashSupported;

if (
     (navigator.appName == "Microsoft Internet Explorer" 
          && navigator.appVersion.indexOf("Mac") == -1 
          && navigator.appVersion.indexOf("3.1") == -1) 
     || (navigator.plugins && navigator.plugins["Shockwave Flash"]) 
     || navigator.plugins["Shockwave Flash 2.0"]){
     flashSupported = true;
else {
     flashSupported = false;

31 July, 2010

Detect IPad Javascript

In my current project I am working on IPad and there are some specific things need to be applied on IPad. We can detect end user's browser and environment information from the navigator using the following code.

var isIPad = navigator.userAgent.match(/iPad/i) != null;