Showing posts from November, 2008

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*": true, "**/*.js": {"when": "$(basename).ts"}     } }

SQL XML output to populate a treeview

In this post I will show howto populate an tree view from the output of sql stored procedure. The table looks like this:pageid pagename parentid--- ---------- -------------1 N1 03 N4 14 N10 35 N7 3SET ANSI_NULLS ONSET QUOTED_IDENTIFIER ONGOALTERPROCEDURE [DBO].[gentree] ASBEGINSET NOCOUNT ON; WITH TREE AS (SELECTCAST(1 ASINT) ASLEVEL, PAGEID, PAGENAME, CAST(RIGHT(' ' + CONVERT(VARCHAR(11),PAGEID),11) ASVARCHAR(120)) AS HIERARCHY FROM PAGE WHERE PARENTID = '0'UNIONALLSELECTLEVEL + 1, B.PAGEID, B.PAGENAME, CAST(A.HIERARCHY + '/' + RIGH…

How To Add Session Timeout Popup in

If you need to alert a user that his session will time out. This is how to do it. Add the following code snippet to the OnInit method on the base page of your application. protectedoverridevoid OnInit(EventArgs e) { base.OnInit(e); string script = "window.setTimeout(\"alert('Your session expired!');\", " + (Session.Timeout - 1) * 60000 + ")"; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "SessionManager", "<script language=\"javascript\">" + script + "</script>"); }

AdRotator control and Database

The AdRotator control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table with a specific schema, and then use a data source control to read the ad records at run time. If you have an existing table with ad information, you can map the schema of your table to the fields that are required by the AdRotator control. You can store ad information in any type of database, as long as you have the corresponding data source control for that database. To create the database table for ads1. If you do not already have a database table that contains the ad information, create a table with the following schema. All columns except ID are optional. Data types are provided as SQL Server types. If you are using a different database, substitute the appropriate corresponding type. Column name Data type Description ID int Primary key. This column can have any name. ImageUrl nvarchar(length) The relative or absolute…

How To Create Slideshow using UpdatePanel and Timer

In this Post i will show how to create Slideshow using UpdatePanel and Timer Control <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN"""><htmlxmlns=""><headrunat="server"><title>Untitled Page</title></head><body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><div><asp:Timerrunat="server"Interval="10000"ID="SlideShowTimer"OnTick="SlideShowTimer_Tick"/><br/><h2style="text-transform: uppercase; margin: 10px 0px 0px 8px; disp…