Skip to main content

Posts

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.
Recent posts

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.

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"> <asp:ListItem>-select-</asp:ListItem> <asp:ListItem>Item1</asp:ListItem> <asp:ListItem>Item2</asp:ListItem> </asp:DropDownList> 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="se

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 //installed. //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; }

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 ;

Bandwidth detection with javascript

In one of my current projects, I came across a scenario to play a video based on the users downloading bandwidth. The detection should be done with javascript. There is a technique, to load an image of known size and calculating the bandwidth on basis of time taken to load that image. Though this technique is not 100% reliable, this will give an approximate estimate of bandwidth. Here is the javascript code to find users bandwidth: var userBandwidth = 0; var startTime; var endTime; var imgSize = 39842; var loadTimeInSec; function GetUserBandwidth() { var testImage = new Image(); testImage.src = "bwtest.jpg"; startTime = ( new Date()).getTime(); testImage.onload = CreateDelegate(testImage, DoneWithTest); } function DoneWithTest() { endTime = ( new Date()).getTime(); loadTimeInSec = (endTime - startTime) / 1000; userBandwidth = (imgSize / loadTimeInSec) / 1024; } Here we are loading a

Delegate in Javascript

Before going to the topic, lets know brief about "Delegate": A delegate is like a function pointer, which stores reference of a method. It specifies a method to call and optionally an object to call the method on. They are used, among other things, to implement callbacks and event listeners. We can create and define delegates in Javascript to perform some specific tasks on an object. The following is the code to define delegate. function CreateDelegate(contextObject, delegateMethod) { return function() { return delegateMethod.apply(contextObject, arguments); } } Let us take a simple example and use the delegate in that. Here is the scenario, there is a large image to be loaded on a web page and we need to display the height and width of that image after loading. Delegate method will be very handy in this situation. var image = new Image(); image.src = "test.jpg"; image.onload = CreateDelegate(image, ImageLoaded); function ImageLoaded() { ale