Tuesday, April 23, 2013

Efficiently Paging Through Large Amounts of Data

Get Sql Records With Row Index
***********************************

You can reduce your record traffic between process

DECLARE @start INT SET @start=2
DECLARE @end INT SET @end=3

SELECT us.UserID
FROM (SELECT ROW_NUMBER() OVER (ORDER BY UserID) AS Row, UserID
     FROM Users.[User]) us
WHERE Row > @start AND Row <= (@start + @end)


Jquery Tab


<script type="text/javascript" src="jquery.js"></script>

/*-------------------------------------------------------------------*/
Put This Function on page

    <script type="text/javascript">

$(document).ready(function() {

    $(".tab_content").hide();
    $(".tab_content:first").show();

    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active");
        $(this).addClass("active");
        $(".tab_content").hide();
        var activeTab = $(this).attr("rel");
        $("#"+activeTab).fadeIn();
    });
});

    </script>
/*-----------------------------------------------------------------------------------*/
Css

<style type="text/css">
               ul.tabs
        {
            margin: 0;
            padding: 0;
            float: left;
            list-style: none;
            height: 32px;
           /* border-bottom: 1px solid #999999;*/
            /*border-left: 1px solid #999999;*/
            width: 90%;
        }
        ul.tabs li
        {
            float: left;
            margin: 0;
            cursor: pointer;
            padding: 0px 21px;
            height: 32px;
            line-height: 31px;
            /*border: 1px solid #999999;*/
            border-left: none;
            font-weight: bold;
            background: #F46004;;
            /*background: rgba(255, 255, 255, .8);*/
            overflow: hidden;
            position: relative;
        }
        ul.tabs li:hover
        {
            background: #CCCCCC;
            color:#fff;
        }
        ul.tabs li.active
        {
            /*background: #F46004;*/
            background: rgba(255, 255, 255, .9);
            color:#F46004;
            /*border-bottom: 1px solid #FFFFFF;*/
        }
        .tab_container
        {
            border: 4px solid rgba(255,255,255,.2);
            /*border: 1px solid #999999;*/
            border-top: none;
            clear: both;
            float: left;
            width: 90%;
            color:#F46004;
            /*background: #FFFFFF;*/
            background: rgba(255, 255, 255, .8);
            font-weight:bold;
           
            height:340px;
           
        }
        .tab_content
        {
            padding: 5px;
            font-size: 1.2em;
            display: none;
        }
        #container
        {
            width: 300px;
            margin: 0 auto;
        }
    </style>

/*-------------------------------------------------------------------*/
html

<div id="container">
        <ul class="tabs">
            <li class="active" rel="tab1">Search</li>
            <li rel="tab2">Register</li>
        </ul>
        <div class="tab_container">
            <!-- #tab1 -->
            <div id="tab1" class="tab_content">
                <p>
                  content
               </p>
           </div>

    

            <!-- #tab2 -->
            <div id="tab2" class="tab_content">
                <p>
                  content
               </p>
           </div>

      </div>

</div> 

Saturday, April 20, 2013

css transition menu like jquery

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE HTML>
<head runat="server">
    <meta charset="utf-8">
    <title>test</title>
    <link href='http://fonts.googleapis.com/css?family=Exo:400,900' rel='stylesheet'
        type='text/css'>
    <!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
    <style>
        /* Style Reset */body, ul, li
        {
            padding: 0;
            margin: 0;
        }
        nav
        {
            display: block;
        }
        ul
        {
            list-style: none;
        }
        a
        {
            text-decoration: none;
            color: #fff;
        }
        p a:hover
        {
            color: #f36;
        }
        body
        {
            background: url(img/dark_Tire.png) #222;
            font-family: 'Exo' , sans-serif;
            font-size: 16px;
            color: #999;
            min-width: 800px;
        }
        nav a
        {
            font-weight: 900;
            font-size: 23px;
            text-transform: uppercase;
        }
        /* menu-1 */#menu-1
        {
            position: fixed;
            top: 200px;
            left: 0;
        }
        #menu-1 a
        {
            padding: 8px 20px;
            margin: 1px 0;
            background: url(images/menu_bg.png) no-repeat -1px top rgba(0,0,0,0.2);
            background-size: 0 100%;
            display: inline-block;
            -moz-transition: all 0.2s ease-out;
            -webkit-transition: all 0.2s ease-out;
            -ms-transition: all 0.2s ease-out;
            transition: all 0.2s ease-out;
        }
        #menu-1 a:hover
        {
            background-size: 100% 100%;
        }
        /* menu-2 */#menu-2 ul
        {
            text-align: center;
        }
        #menu-2 li
        {
            display: inline-block;
        }
        #menu-2 a
        {
            padding: 8px 20px;
            margin: 0 1px;
            background: url(images/menu_bg.png) no-repeat left -1px rgba(0,0,0,0.2);
            background-size: 100% 0;
            display: block;
            -moz-transition: all 0.2s ease-out;
            -webkit-transition: all 0.2s ease-out;
            -ms-transition: all 0.2s ease-out;
            transition: all 0.2s ease-out;
        }
        #menu-2 a:hover
        {
            background-size: 100% 100%;
        }
        /* others */
        h1
        {
            color: #f36;
            text-align: center;
            margin-top: 200px;
            padding: 0 200px;
        }
        p
        {
            text-align: center;
            padding: 0 200px;
        }
    </style>
</head>
<body>
    <nav id="menu-2">
    <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Portfolio</a></li>
        <li><a href="#">My Blog</a></li>
        <li><a href="#">Contact Me</a></li>
    </ul>
</nav>
  <!--  <nav id="menu-2">
    <ul>
   
        <li><a href="#">Home</a></li><li><a href="#">About</a></li><li><a href="#">Portfolio</a></li><li><a href="#">My Blog</a></li><li><a href="#">Contact Me</a></li>
    </ul>
</nav>-->
</body>
</html>

Friday, April 19, 2013

Sorting in Gridview Aasp.Net

* Java Script *


<script src="scripts/jquery-1.4.3.min.js" type="text/javascript"></script>

    <script src="scripts/jquery.tablesorter.min.js" type="text/javascript"></script>
------------------------------------------------------------------------------------------
* JS Function *

    <script type="text/javascript">
        $(document).ready(function() {
            $("#" + '<%=grvMember.ClientID%>').tablesorter();
        });
    </script>

----------------------------------------------------------------------------------
GridView on aspx Page   *

<asp:GridView ID="grvMember" runat="server" AutoGenerateColumns="false" CssClass="tbl-grid"
                GridLines="None" Width="100%" OnRowDataBound="grvMember_OnRowDataBound">
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Name
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblMemberID" runat="server" Visible="false" Text='<%#Eval("MemberID") %>'></asp:Label>
                            <asp:Label ID="lblprice" runat="server" Visible="false" Text='<%#Eval("price") %>'></asp:Label>
                            <asp:Label ID="lblEmailID" runat="server" Visible="false" Text='<%#Eval("EmailID") %>'></asp:Label>
                                                           <asp:Label ID="MemberName" runat="server" Text='<%#Eval("MemberName") %>'></asp:Label>
                                                  </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Gender
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Gender" runat="server" Text='<%#Eval("Gender") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Height/Weight
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Height" runat="server" Text='<%#"H-"+Eval("Height")+", W-"+Eval("Weight") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Membership Type
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="MembershipType" runat="server" Text='<%#Eval("MemberTypeName")%>'></asp:Label>
                            <asp:Label ID="ValidMonth" runat="server" Font-Size="10px" Text='<%#Eval("ValidMonth") %>'></asp:Label>
                            <asp:Label ID="MemberTypeID" Visible="false" runat="server" Text='<%#Eval("MemberTypeID") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            B'Date
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="DateofBirth" runat="server" Text='<%#Eval("DateofBirth","{0:dd/MM/yyyy}") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <%--<asp:TemplateField>
                        <HeaderTemplate>
                            Payment Last Date
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="LastDatefoPayment" runat="server" Text='<%#Eval("LastDatefoPayment","{0:dd/MM/yyyy}"+" ("+Eval("RamainDay")+")") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>--%>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Photo
                        </HeaderTemplate>
                        <ItemTemplate>
                            <img src='<%#"../"+Eval("PhotoPath") %>' width="25" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            Visite
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="ProfileViewed" runat="server" Text='<%#Eval("ProfileViewed") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                                                            </Columns>
            </asp:GridView>

7 JavaScript Differences Between Firefox & IE

1. The CSS “float” property

The basic syntax for accessing a specific css property for any given object is object.style.property, using camel casing to replace a hyphenated property. For example, to access the background-colorproperty of a <div> whose ID is “header”, we would use the following syntax:

  1. document.getElementById("header").style.backgroundColor= "#ccc";  
But since the word “float” is already reserved for use in JavaScript, we cannot access the “float” property usingobject.style.float. Here is how we do it in the two browsers:

The IE Syntax:


  1. document.getElementById("header").style.styleFloat = "left";  

The Firefox Syntax:


  1. document.getElementById("header").style.cssFloat = "left";  

2. The Computed Style of an Element

JavaScript can easily access and modify CSS styles that have been set on objects using theobject.style.property syntax outlined above. But the limitation of that syntax is that it can only retrieve styles that have been set inline in the HTML or styles that have been set directly by JavaScript. The style object does not access styles set using an external stylesheet. In order to access an object’s “computed style”, we use the following code:

The IE Syntax:


  1. var myObject = document.getElementById("header");  
  2. var myStyle = myObject.currentStyle.backgroundColor;  

The Firefox Syntax:


  1. var myObject = document.getElementById("header");  
  2. var myComputedStyle = document.defaultView.getComputedStyle(myObject, null);  
  3. var myStyle = myComputedStyle.backgroundColor;  

3. Accessing the “class” Attribute of an Element

As is the case with the “float” property, our two major browsers use different syntax to access this attribute via the getAttribute method in JavaScript.

The IE Syntax:


  1. var myObject = document.getElementById("header");  
  2. var myAttribute = myObject.getAttribute("className");  

The Firefox Syntax:


  1. var myObject = document.getElementById("header");  
  2. var myAttribute = myObject.getAttribute("class");  
This syntax would also apply using the setAttribute method.


4. Accessing the “for” Attribute of the <label> Tag

Similar to number 3, we have different syntax to access a <label> tag’s “for” attribute in JavaScript.

The IE Syntax:


  1. var myObject = document.getElementById("myLabel");  
  2. var myAttribute = myObject.getAttribute("htmlFor");  

The Firefox Syntax:


  1. var myObject = document.getElementById("myLabel");  
  2. var myAttribute = myObject.getAttribute("for");  

5. Getting the Cursor Position

It would be rare that you would want to find the cursor position of an element, but if for some reason you need to, the syntax is different in IE and Firefox. The code samples here are fairly basic, and normally would be part of a much more complex event handler, but they serve to illustrate the difference. Also, it should be noted that the result in IE will be different than that of Firefox, so this method is buggy. Usually, the difference can be compensated for by getting the “scrolling position” — but that’s a subject for another post!

The IE Syntax:


  1. var myCursorPosition = [0, 0];  
  2. myCursorPosition[0] = event.clientX;  
  3. myCursorPosition[1] = event.clientY;  

The Firefox Syntax:


  1. var myCursorPosition = [0, 0];  
  2. myCursorPosition[0] = event.pageX;  
  3. myCursorPosition[1] = event.pageY;  

6. Getting the Size of the Viewport, or Browser Window

Sometimes it’s necessary to find out the size of the browser’s available window space, usually called the “viewport”.

The IE Syntax:


  1. var myBrowserSize = [0, 0];  
  2. myBrowserSize[0] = document.documentElement.clientWidth;  
  3. myBrowserSize[1] = document.documentElement.clientHeight;  

The Firefox Syntax:


  1. var myBrowserSize = [0, 0];  
  2. myBrowserSize[0] = window.innerWidth;  
  3. myBrowserSize[1] = window.innerHeight;  

7. Alpha Transparency

Okay, this is not a JavaScript syntax issue — alpha transparency is set via CSS. But when objects fade in and out via JavaScript, this is done by accessing CSS alpha settings, usually inside of a loop. The CSS code that needs to be altered via JavaScript is as follows:

The IE Syntax:


  1. #myElement {  
  2.     filter: alpha(opacity=50);  
  3. }  

The Firefox Syntax:


  1. #myElement {  
  2.     opacity: 0.5;  
  3. }  
So, to access those values via JavaScript, we would use the style object:

The IE Syntax:


  1. var myObject = document.getElementById("myElement");  
  2. myObject.style.filter = "alpha(opacity=80)";  

The Firefox Syntax:


  1. var myObject = document.getElementById("myElement");  
  2. myObject.style.opacity = "0.5";  
Of course, as mentioned, normally the opacity/alpha would be changed in the midst of a loop, to create the animating effect, but this simple example clearly illustrates how it’s done.

Opps Part 1 : Abstraction

  Abstraction in C# is a fundamental concept of object-oriented programming (OOP) that allows developers t...