Today Morning one of my Colleague gave me this puzzle.... ALBERT EINSTEIN'S RIDDLE ARE YOU IN THE TOP 2% OF INTELLIGENT PEOPLE IN THE WORLD? SOLVE THE RIDDLE AND FIND OUT. There are no tricks, just pure logic, so good luck and don't give up. 1. In a street there are five houses, painted five different colors. 2. In each house lives a person of different nationality 3. These five homeowne...
Download demo application - 6.57 KB Introduction In this blog I'm going to explain how you can bind a TreeView control to a hierarchical data through recursion . TreeView Control Simply drag and Drop a TreeView control by keeping the value of AutoGenerateDataBindings property equal to false . Target Hierarchical Data Target hierarchical data that I've chosen for this demo is a folder's h...
Introduction In this blog I'm going to pesent how Meta tag can be added on an ASP.NET page programmatically. For other methods, please read the following blogs - Emulating IE7 in IE8 – By adding a Http Header in IIS Emulating IE7 in IE8 – By adding a Meta tag within the head tag on all the pages Emulating IE7 in IE8 – By defining a Custom Header in Web.Config file Method Simply add a Met...
Introduction In my last blogs, I had demonstrated how one could emulate IE7 in IE8 demonstrated by adding a Http Header in IIS or by adding a Meta tag within the head tag on all the pages of a web application. Now we'll learn how you can emulate IE7 in by defining a Custom Header in Web.Config file. Method Site administrators can configure their sites to default to a specific document co...
Introduction In my last blog: Emulating IE7 in IE8 – By adding a Http Header in IIS I had explained how one could emulate IE7 in IE8 through IIS by adding an Http Header . Now in this article I'm going to exhibit how one can achieve the same by adding a Meta tag within the head tag on each page of the web application. Method Simpley add a Meta tag ( <meta http-equiv="X-UA-Compatible" ...
Introduction If an ASP.NET web application is working fine in IE6 & IE7 and if you want that the same web application will work in similar manner with IE8 browser without any problem, then you can do it easily by emulating IE7 in IE8 by various ways. In this blog I’m going to explain how can achieve it by simply adding an Http Header in IIS . Adding an Http Header Step I: Open IIS , ...
In this blog i will show how to disable and enable checkboxes on the click of other checkbox with javascript . I am explaining it by taking a example where there are three checkboxes . On the click of first checkbox the next two checkboxes will get enabled or disabled depending upon the checked state of first checkbox. Here is the sample code: <html xmlns="http://www.w3.org/1999/xhtml...
In this blog i will explain how to select records falling between two dates. Below is the sample script : DECLARE @MyTable TABLE ( ID INT IDENTITY, [MyColumn] VARCHAR(20) ) INSERT INTO @MyTable SELECT 'Jan 7 2010 7:38PM' UNION ALL SELECT 'Feb 7 2010 7:38PM' UNION ALL SELECT 'Mar 7 2010 7:38PM' UNION ALL SELECT 'Apr 7 2010 7:38PM' UNION ALL SELECT 'May 7 2010 7:38PM' UNION ALL SELECT 'Jun...
In this blog i will show how to add two numbers with javascript. I have used parseInt function to convert the value from string to int. Below is the sample code: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> First Number :<input id="txtFirstNumber" type="text" /><br /&g...
In this blog i will explain how to remove link line from hyperlink. I have set textdecoration property as none for hyperlink which will remove its link line. Below is the sample code: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:Li...
In this blog i will show how to retrieve identity value of last inserted record. I have used Scope_Identity to get the last identity value. Below is the sample script: DECLARE @Tags TABLE ( TagId INT IDENTITY(1,1), TagName VARCHAR(100) ) INSERT INTO @Tags VALUES ('c') SELECT SCOPE_IDENTITY() AS [Newly Added Identity] --OUTPUT --Newly Added Identity ---------------------------------------...
In this blog i will show how to validate atleast one checkbox is checked in checkboxlists. Say we have multiple checkboxes and we have to validate atleast one checkbox is checked from multiple checkboxes. Below is the sample code: In Javascript: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> </head> ...
In this blog i will show how to delete a record from database using ADO.NET. I have used one text box and one button, user will enter id and click submit button, accordingly row will be deleted from database. Here is the code In Sql CREATE TABLE [Test_Table] ([ID] INT IDENTITY ,[NAME] VARCHAR(20) ) GO INSERT INTO [Test_Table] SELECT 'NAME1' UNION ALL SELECT 'NAME2' UNION ALL SELECT 'NAME...
In this blog i will show how to get average of records in SQL, I have used Avg function of sql in order to do it. The AVG() function returns the average value of a numeric column. Below is the sample script: DECLARE @tblCustomers TABLE ( ID INT IDENTITY, NAME VARCHAR(20), Amount INT ) INSERT INTO @tblCustomers SELECT 'Name1',100 UNION ALL SELECT 'Name2',200 UNION ALL SELECT 'Name3',300 U...
In this blog i will show how to check uncheck all checkboxes in Gridview. In many requirements we need a column with checkboxes, and to select all the checkboxes in this column we have one more column in the Header. On selecting this checkbox all the checkboxes in this column are selected and on unchecking the header checkbox all the checkboxes in this column are unchecked. Below is the ...
In this blog i will show how to select data from multiple tables in SQL, though it is simple but it will help many Below is the sample script: DECLARE @A TABLE ( customer_id INT , Product_ID INT ) DECLARE @B TABLE ( customer_id INT ,customer_username VARCHAR(20),customer_password VARCHAR(20) ) DECLARE @C TABLE ( id INT ,product_image VARCHAR(20) ) INSERT INTO @B SELECT 1,'Name1','Pass1' ...
In this blog i will explain how to open or expand a div on click of hyperlink. I have used jQuery for this purpose Below is the sample code: In ASPX: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" > <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> ...
In this blog i will show how to change the forecolor property of a control in code behind.I will use the label control in below sample. Below is the code: In ASPX <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestProject.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transi...
In this blog i will show how to check uncheck all checkboxes in Repeater. In many requirements we need a column with checkboxes, and to select all the checkboxes in this column we have one more column in the Header. On selecting this checkbox all the checkboxes in this column are selected and on unchecking the header checkbox all the checkboxes in this column are unchecked. Below is the ...
In this blog i will explain how to use ResolveUrl with link tag. Many times we need to give root relative path to href attribute of link tag so i used ResolveURl. ASP.NET internally resolves the URL passed to ResolveUrl at the root-relative URL. Below is the sample code: In ASPX: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></ti...
In this blog I will show how to find maximum and minimum of each group of records in SQL Below is the sample script: Maximum of each group: DECLARE @Test_Max TABLE (Id INT,[Data] VARCHAR(30),[Amount] INT) INSERT INTO @Test_Max VALUES(1,'Data1',10) INSERT INTO @Test_Max VALUES(1,'Data2',20) INSERT INTO @Test_Max VALUES(1,'Data3',60) INSERT INTO @Test_Max VALUES(1,'Data4',15) INSERT INTO @...
In this blog i will show how to check uncheck all checkboxes in Datalist. In many requirements we need a column with checkboxes, and to select all the checkboxes in this column we have one more column in the Header. On selecting this checkbox all the checkboxes in this column are selected and on unchecking the header checkbox all the checkboxes in this column are unchecked. Below is the ...
In this blog i will explain how to get records having data in datecolumn greater than today. Below is the script: DECLARE @mytable TABLE ( [MyDateColumn] DATETIME ) INSERT INTO @mytable SELECT '11-11-2009' UNION ALL SELECT '11-11-2009' UNION ALL SELECT '11-10-2009' UNION ALL SELECT '11-10-2009' UNION ALL SELECT '11-10-2009' UNION ALL SELECT '11-10-2009' UNION ALL SELECT '11-05-2009' UNIO...
In this blog i will show how to change the column datatype in sql with query. Here is the syntax: ALTER TABLE [mytable] ALTER COLUMN [mycolumn] newtype Below is the sample script which will explain you how to change the datatype of the column: GO IF EXISTS ( SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[MyTable]') AND OBJECTPROPERTY(OBJECT_ID, N'IsUserTable') = 1 ) DROP ...
In this blog i will show how to pass table name dynamically in the query. Many times we have the requirement in which we can't use the tablename directly in our query in SQL so we need a wa y by which we can pass it dynamically .Below is the sample script: CREATE TABLE TEST ( customer_id INT ,customer_username VARCHAR(20),customer_password VARCHAR(20) ) GO INSERT INTO TEST SELECT 1,'Name...
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address:
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18