Wednesday, February 17, 2016

SQL Query for pagination

SELECT *
FROM ( SELECT
ROW_NUMBER() OVER (ORDER BY id) as row,*
FROM tbl_Stock) a
WHERE row > 0 and row <= 20

UpdateProgress


Design Code :

<style type="text/css">
        .modal {
            position: fixed;
            z-index: 999;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: Black;
            opacity: 0.6;
        }

        .center {
            z-index: 1000;
            margin: 300px auto;
            padding: 10px;
            width: 130px;
        }

            .center img {
                height: 128px;
                width: 128px;
            }
    </style>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server"></asp:ScriptManager>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
            <ProgressTemplate>
                <div class="modal">
                    <div class="center">
                        <img alt="" src="loader.gif" />
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div style="text-align:center;">
                    <asp:Button ID="Button1" Text="Click Me" runat="server" OnClick="Button1_Click" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>

Put code in code behind (.cs) file.

protected void Button1_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(5000);
    }

Output :





Find detail about Stored Procedure or Table


How to know table or columnname used in which stored procedure?


select * from sys.sql_modules where definition like '%id%'

How to know “stored procedure” created and modified date?


SELECT name, create_date, modify_date FROM sys.objects
WHERE type = 'P'

How to know “table” created and modified date?


SELECT name, create_date, modify_date FROM sys.objects
WHERE type = 'U'


How to know “view” created and modified date?


SELECT name, create_date, modify_date FROM sys.objects
WHERE type = 'V'

Disable right click using javascript

<script type="text/javascript">
        //Message to display whenever right click on website
        var message = "Sorry, right click has been disabled.";
        function click(e) {
            if (document.all) {
                 //Check the Mouse Button which is clicked.
                if (event.button == 2 || event.button == 3) {
                    //  alert(message);
                    return false;
                }
            }
            else {
                if (e.button == 2 || e.button == 3) {
                    e.preventDefault();
                    e.stopPropagation();
                    // alert(message);
                    return false;
                }
            }
        }
        if (document.all) {
            document.onmousedown = click;
        }
        else {
            document.onclick = click;
        }
        document.oncontextmenu = function () {
            return false;
        };
    </script>