Wednesday, August 26, 2009

javascript get table row count

document.getElementById('tablename').rows.length

Friday, August 21, 2009

Whats the Difference between Cluster and Non-cluster index ?

Clustered Index

* There can be only one Clustered index for a table
* Usually made on the primary key
* The logical order of the index matches the physical stored order of the rows on disk

Non-Clustered Index

* There can be only 249 Clustered index for a table
* Usually made on the any key
* The logical order of the index does not match the physical stored order of the rows on disk

Silverlight : How To Bring Control To Front

Canvas.SetZIndex(Your_Element_Name,Value_To_Bring_It_To_Front);

Thursday, August 13, 2009

How To Create Dynamic TextBox With Event Handler

    protected void Page_Load(object sender, EventArgs e)
    {
        createTxt();
    }

    private void createTxt()
    {
       
        TextBox txt = new TextBox();
        txt.ID = "txt1";
        txt.AutoPostBack = true;
        txt.TextChanged += new EventHandler(txt_TextChanged);
        form1.Controls.Add(txt);       
    }

    void txt_TextChanged(object sender, EventArgs e)
    {
        TextBox txtBx = (TextBox)sender;
        Page.Title = txtBx.Text;
    }


Wednesday, August 12, 2009

JavaScript Error Handling

JavaScript Standard Error Instance Properties
constructor
    Specifies the function that created an instance's prototype.
message
    Error message.
name
    Error name.

<html>
    <head>
        <title>Error Handling</title>
        <script language='javascript'>
        window.onload = function()
        {
            try
            {
                var x = 1;
                var value = x / y;               
            }
            catch(err)
            {
                alert("constructor"+ ": " + err.constructor +'\r\n' + 'message'+ ": " + err.message + '\r\n' + 'name' + ": "+ err.name);
            }
            finally
            {
                alert("Finally block");
            }

        }
        </script>
    </head>
</html>


How To Detect Silverlight Installed In Client Machine

<html>
    <body>
        <script language="javascript">
        var browser = navigator.appName;
        var SLInstalled = false;
        if (browser == 'Microsoft Internet Explorer')
        {
            try
            {
                var slControl = new ActiveXObject('AgControl.AgControl');//IE
                SLInstalled = true;
            }
            catch (e)
            {
                SLInstalled = false;
            }
        }
        else
        {   
            try
            {
                if (navigator.plugins["Silverlight Plug-In"]) // Other Than IE
                {
                    SLInstalled = true;
                }
            }
            catch (e)
            {
                SLInstalled = false;
            }
        }
            if(SLInstalled == true)
            {
                    alert('Silverlight Installed');
            }
            else
            {
                  alert('Silverlight Not Installed');
             }
        </script>
    </body>
</html>


Tuesday, August 11, 2009

How To Reset DoubleAnimationUsingKeyFrames

YourDoubleAnimationUsingKeyFramesName.KeyFrames.Clear();

How To Triggers Event In Silverlight

// Inlcude These two namespaces for the Automation Process
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;


ButtonAutomationPeer buttonAutoPeer = new ButtonAutomationPeer(YourButtonName);
IInvokeProvider invokeProvider = buttonAutoPeer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
invokeProvider.Invoke();


Monday, August 10, 2009

How To Get Storyboard Current Status

Syntax
          StoryboardName.GetCurrentState

GetCurrentState Method enumeration values are
          Active    -  The current animation changes in direct relation to that of its parent.
          Filling    -  The animation continues and does not change in relation to that of its parent.
          Stopped  -  The animation is stopped.


How To Convert a string to TimeSpan

TimeSpan.Parse("00:00:00");

What's the difference between a member variable, and a local variable?

A member variable is a variable that belongs to an object, whereas a local variable belongs to the current scope.

class MoterVehicle{

  String licensePlate = "";     // member variable
  double speed;       = 0.0;    // member variable
  double maxSpeed;    = 123.45; // member variable
 
  boolean isSpeeding() {
    double excess;    // local variable
    excess = this.maxSpeed - this.speed;
    if (excess < 0) return true;
    else return false;
  }

}

Monday, August 3, 2009

Silverlight Alert Box

System.Windows.Browser.HtmlPage.Window.Invoke("Alert", "Testing");

How To Hide Legend In PieChar Silverlight

<UserControl x:Class="Charting.Pagee"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">

        <charting:Chart Title="Legend Disabled">         

            <charting:Chart.LegendStyle>
                
                <Style TargetType="datavis:Legend">
                    
                    <Setter Property="Width" Value="0"/>
                    <Setter Property="Height" Value="0"/>
                    
                </Style>
                
            </charting:Chart.LegendStyle>
            
            <charting:Chart.Series>
                
                <charting:PieSeries  DependentValuePath="X" >                    
                    <charting:PieSeries.ItemsSource>
                        <PointCollection>
                            <Point X="1"/>
                            <Point X="2"/>
                            <Point X="3"/>
                            <Point X="4"/>
                        </PointCollection>
                    </charting:PieSeries.ItemsSource>
                </charting:PieSeries>
                
            </charting:Chart.Series>
            
        </charting:Chart>
    </Grid>
</UserControl>