Friday, July 31, 2009

Silverlignt How To Get The Cell Content Of The DataGrid When AutoGenerateColumns Set True

private void dg_SelectionChanged(object sender, SelectionChangedEventArgs e)
           TextBlock tb = dg.Columns[0].GetCellContent(e.AddedItems[0]) as TextBlock;
           //tb.text will hold the Column Content

Wednesday, July 29, 2009

Create GIF Animations Online

Now you can create animated pictures and animated effects from your photos, for free. is a web service that allows you create GIF Animations online without downloading anything.


Reason For Getting This Error "AG_E_PARSER_BAD_PROPERTY_VALUE"

I) Haven't defined the event handler in code behind, but have assigned it in xaml
II) not setting the correct event args type on the handler

How To Change the start page Silverlight XAML

Go to app.xaml.cs, find Application_Startup, set your xaml page which you want to run during startup.

private void Application_Startup(object sender, StartupEventArgs e)
// this.RootVisual = new Page(); // Default
this.RootVisual = new UserDefinedXaml(); // Changed Xaml, if u add UserDefinedXaml.xaml to your project.

Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
Me.RootVisual = New UserDefinedXaml()
End Sub

Tuesday, July 28, 2009

How To Round Off The Decimal String


OutPut : 18

Monday, July 27, 2009

how to get The Business Dates between the two given dates

CREATE FUNCTION dbo.fnGetNoOfBusinessDates
(@STARTDATE datetime,@EntDt datetime)
with DateList as
    select cast(@STARTDATE as datetime) DateValue
    union all
    select DateValue + 1 from    DateList   
    where  DateValue + 1 < convert(VARCHAR(15),@EntDt,101)
 )select * from DateList where DATENAME(WEEKDAY, DateValue ) not IN ( 'Saturday','Sunday' )

select * from dbo.fnGetNoOfBusinessDates(getdate(),getdate()+30);

Friday, July 24, 2009

how to get number of business days between two given dates

CREATE FUNCTION dbo.fnGetNoOfBusinessDays(@STARTDATE datetime,@EntDt datetime)
returns int
declare @dtCnt int;
;with DateList as 
    select cast(@STARTDATE as datetime) DateValue 
    union all 
    select DateValue + 1 from    DateList    
    where   DateValue + 1 < convert(VARCHAR(15),@EntDt,101) 
    select @dtCnt = count(*) from DateList where DATENAME(WEEKDAY, DateValue ) not IN ( 'Saturday','Sunday' )
return @dtCnt

select dbo.fnGetNoOfBusinessDays(getdate(),getdate()+50) as NoOfBusinessDays

Thursday, July 23, 2009

What's the difference between Dataset.clone and Dataset.copy ?

    Clone :- It only copies structure, does not copy data.
    Copy  :- Copies both Structure and data

Boxing & UnBoxing

C# provides two types of variables they are Value types and Reference Types. Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as boxing and converting reference type back to the value type is known as unboxing.


class Test
    static void Main() {
        int i = 1;
        object o = i;        // boxing
        int j = (int) o;     // unboxing

Tuesday, July 21, 2009

SQL Azure

Microsoft® SQL Azure delivers on the Microsoft Data Platform vision of extending the SQL Server capabilities to the cloud as web-based services, enabling you to store structured, semi-structured, and unstructured data. SQL Azure will deliver a rich set of integrated services that enable you to perform relational queries, search, reporting, analytics, integration and synchronize data with mobile users, remote offices and business partners. Currently, SQL Azure offers relational database service called Microsoft® SQL Azure Database. Other services will be available in future.

As a part of the Windows Azure platform, SQL Azure Database will deliver traditional relational database service in the cloud, supporting T-SQL over Tabular Data Stream (TDS) protocol. SQL Azure Database will be available in two editions: the Web Edition Database and the Business Edition Database.

Web Edition – 2GB of T-SQL based database space for $9.99 per month
Business Edition – 10GB of T-SQL based database space for $99.99 per month.
Customers can also purchase bandwidth for $.10 in and $.15 out per GB

SQL Azure Database is on track to deliver a public CTP in August and ship in the second half of calendar year 2009. In its initial release, SQL Azure Database will support relational capabilities suitable for relational apps, including multi-tenant apps requiring large levels of scale. Future releases of SQL Azure will support advanced features like distributed queries across partitions, and auto-partition. Developers will be able to utilize existing Transact-SQL code to access their data in the cloud.

Read More About SQL Azure.

Reference : Pinal Dave (

Monday, July 20, 2009

whats the Difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript

The RegisterClientScriptBlock method inserts the client-side script immediately below the opening tag of the Page object's
element. Form elements at this stage are not instantiated, so the code cannot access the form elements.

The RegisterStartupScript method inserts the specified client-side script just before the closing tag of the Page object's
element. Form elements at this stage are instantiated, so the code can access the form elements.

Thursday, July 16, 2009

Google Services At a Glance

GButts Display all of your Google Services as buttons just next to your addressbar or anywhere you like it!
Download Firefox GButts Extension

Wednesday, July 15, 2009

How To Set Textbox first letter in caps

<input id='txt1' type='text' style='text-transform:capitalize;' value='sample data'  />


Tuesday, July 14, 2009

How To Parse Url Query String Using JavaScript

function parseUrl(name)
      name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
      var regexStr = "[\\?&]"+name+"=([^&#]*)";
      var regex = new RegExp( regexStr );
      var results = regex.exec(window.location.href);
      if( results == null )
        return "";
        return results[1];

How To call = alert(parseUrl(QryStringParameterName));

Example Click Here

Retrieve Content From Web Page - Screen Scraping

To retrieve the HTML code of a URL(this process is know as Screen Scraping), .NET provides WebClient class under System.Net namespace.Here I created a sample method which takes a URL and returns the HTML code.Include System.Net & System.Text namespaces

    private string GetPageContent(string url)
string src = string.Empty;
WebClient client = new WebClient();
UTF8Encoding encoding = new UTF8Encoding();
                      src = encoding.GetString(client.DownloadData(url));
catch (Exception ex)
return src;

Close Window from CodeBehind

Page.RegisterStartupScript("CloseWin", "<script language='javascript'>{self.close();}</script>;");

When we can declare a column as Unique and Not Null both at the same time. What is the use Primary Key then?

Unique Key creates Non-Cluster index in default, But in Primary Key creates Cluster index in default.

1)unique key can be null but Primary key cant be null.

2)primary key can be referenced to other table as Foreign Key.

3)we can have multiple unique key in a table but PK is one and only one.

Primary key in itself is unique key.

Primary key which allows only unique+not null values,where has unique allow unique and null values because a null value is not equal to a null value

Monday, July 13, 2009

How To Delete Browser Page Cache

Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00));

Friday, July 10, 2009

Check Your Website Search Ranking

InstantRankmeter is an online service that gives you a complete statistical overview on how your website is performing within the Google, Bing and Yahoo! search engines

ASP.NET Page Life Cycle Overview

Page Life-cycle Stages

Page Request
Page Initialization
Postback Event Handling

Life-cycle Events


Thursday, July 9, 2009

What is the difference between Convert.ToInt32 and Int32.Parse

if(STRING != null)
    Convert.ToInt32(string) AND Int32.Parse(string) Yield Identical Results;
     Int32.Parse(null) throws an ArgumentNullException;
     Convert.ToInt32(null) returns a zero;

How To Do Case Insensitive String Comparison

        if (System.String.Compare("xploredotnet", "XPlorEdotnet", true) == 0)

Wednesday, July 8, 2009

Whats The Difference Between string and stringbuilder


Strings are immutable and they are actually returning a modified copy of the string.


Strings are mutable there object as a buffer that can contain a string with the ability to grow from zero characters to the buffer's current capacity. Until you exceed that capacity, the string is assembled in the buffer and no object is allocated or released. If the string becomes longer than the current capacity, the StringBuilder object transparently creates a larger buffer. The default buffer initially contains 16 characters

Google Apps is out of beta (yes, really)

Gmail, Google Calendar, Google Docs and Google Talk — both enterprise and consumer versions — are now out of beta. "Beta" will be removed from the product logos today, but we'll continue to innovate and improve upon the applications whether or not there's a small "beta" beneath the logo . more...

Tuesday, July 7, 2009

How To Get IP Address

<title>WMI Scripting HTML</title>
<script FOR="foo" EVENT="OnCompleted(hResult,pErrorObject, pAsyncContext)" LANGUAGE="JScript">
document.getElementById('divMACAddr').innerHTML='Machine Number :'+unescape(vMACAddr);
document.getElementById('divIPAddr').innerHTML='IP Address :'+unescape(vIPAddr);
document.getElementById('divDNSName').innerHTML='DNS Name '+unescape(vDNSName);

<script FOR="foo" EVENT="OnObjectReady(objObject,objAsyncContext)" LANGUAGE="JScript">
if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true)
if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
vMACAddr = objObject.MACAddress;

if(objObject.IPEnabled && objObject.IPAddress(0) != null && objObject.IPAddress(0) != "undefined")
vIPAddr = objObject.IPAddress(0);

if(objObject.DNSHostName != null && objObject.DNSHostName != "undefined")
vDNSName = objObject.DNSHostName;

<object classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6" id="locator" VIEWASTEXT></object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223" id="foo"></object>

<script LANGUAGE="JScript">
var service = locator.ConnectServer();
var vMACAddr ;
var vIPAddr ;
var vDNSName;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');

<form method="POST" action="NICPost.asp" id="formfoo" name="formbar">
<div id="divMACAddr"></div>
<div id="divIPAddr"></div>
<div id="divDNSName"></div>

Note:ActiveX to be Enabled, It Will Prompt to Get User To allow or not allow(IE )

Vizerra- 3D Virtual Models of World Heritage Sites

is a unique software, which allows us to visit all the most beautiful
places in the world!,we can surf the highest quality 3D copies of these sites,
listen to audio guides, read their detailed descriptions provided by reputable
Publishers and Museums, or use a full-functional map service. And all this in
just one application!they give us a chance to travel around the globe right from
your personal computer and for absolutely free of charge.

Vizerra is the first world’s first 3D educational portal which enable its users to
travel to different historic locations Old Town Square, Macchu Picchu and Angkor
Vat directly from your computer. This software is useful for those lazy guys and girls
who are curious but do not want to spend their money on traveling to particular
destination.Besides offering high quality 3D copies of these sites, it also provides audio
guides with detailed description made by reputable publishers and museums.

(Source Vizerra)

Icon Finder - Find the prefect Icon for WebPages

Icon finder is an icon search engine, which can allow us to find prefect icons for webpages. All you need to do is just search for the icon you needed to you, the image can be download in 2 formats(PNG,ICO).You can use these icons as favicon icon and add them to your webpages. You can also customize the background of these icons.They have 159 icon sets. You can search them via browsing

Friday, July 3, 2009

How To Find Position Of An HTML element

function GetPos(Cord,Obj) {
var curPos = 0;
try {
case 'X':
case 'Y':
if (Obj.offsetParent)
while (1)
if(Cord == 'X'){
curPos += Obj.offsetLeft;
curPos += Obj.offsetTop;
if (!Obj.offsetParent) break; Obj = Obj.offsetParent;
if(Cord == 'X'){
if (Obj.x)curPos += Obj.x;
if(Obj.y)curPos += Obj.y;
catch (e) {
document.write('An exception occurred.');
finally {
return curPos;

function callfn(Cord, func, obj) {

return func(Cord, obj);

//way of Calling Function
"alert(callfn('X',GetPos,document.getElementById('elementId')))" // X co-ordinates
"alert(callfn('Y',GetPos,document.getElementById('elementId')))" // Y co-ordinates

Generate Random Number and Character JavaScript

function GenChar(mode, len) {
            var chars = null;
            var string_length = len;
            try {
                switch (mode) {
                    case 'U':
                        chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZ";
                    case 'L':
                        chars = "abcdefghiklmnopqrstuvwxyz";
                    case 'N':
                        chars = "0123456789";
                    case 'UN':
                        chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
                    case 'LN':
                        chars = "0123456789abcdefghiklmnopqrstuvwxyz";
                    case 'Mix':
                        chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
                    default: chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";

                var randomstring = '';
                for (var i = 0; i < string_length; i++) {
                    var rnum = Math.floor(Math.random() * chars.length);
                    randomstring += chars.substring(rnum, rnum + 1);
            catch (e) {
                document.write('An exception occurred.');
            finally {
                return randomstring;

        function callGenfn(mode, func, length) {
            return func(mode, length);


alert(callGenfn('N', GenChar,6));
alert(callGenfn('U', GenChar,6));
alert(callGenfn('L', GenChar,6));
alert(callGenfn('UN', GenChar,6));
alert(callGenfn('LN', GenChar,6));
alert(callGenfn('Mix', GenChar,6));

Thursday, July 2, 2009

Firefox 3.5

Finally Firefox 3.5 which is more than twice as fast as Firefox 3 has launched.Download

What’s New in Firefox 3.5:

Firefox 3.5 makes surfing the Web easier and more enjoyable with
exciting new features and platform updates that allow Web developers to
create the next generation of Web content. Native support for open
video and audio, private browsing, and support for the newest Web
technologies will enable richer, more interactive online experiences.

  • Performance.
  • Open Video and Audio.
  • Privacy Controls.
  • Location Aware Browsing. more....

Wednesday, July 1, 2009

How to get browser width and height

    <title>Get Browser Width & Height</title>
    <script languuage='javascript'>
        var BWidth,BHeigth;
        function fn() {
            if (typeof window.innerWidth != 'undefined') { // For (mozilla/netscape/opera/IE7)
                BWidth = window.innerWidth;
                BHeigth = window.innerHeight;
            else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' &&
                    document.documentElement.clientWidth != 0) { // For (IE 6 with proper doctype)
                    BWidth = document.documentElement.clientWidth;
                    BHeigth = document.documentElement.clientHeight;
            else { //For (IE < 6)
                    BWidth = document.getElementsByTagName('body')[0].clientWidth,
                    BHeigth = document.getElementsByTagName('body')[0].clientHeight
            document.title = 'Your Browser width is ' + BWidth + ' Height is' + BHeigth;
<body onresize='fn()'>
    <h3>See The Page Title While Resizing the Page (Width & Height Will Be Changing</h3>