Loading ...

ASP.NET Blogs | CodeAsp.Net

Who is online?  0 guests and 0 members
home  »  blogs  »  blogs: December 2009

Communifire Blogs

Blogs : December 2009 postings

Rami Reddy

Solving Einstein riddle in sql

12/31/2009 by Rami Reddy · 1 · 2763

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...

Samir NIGAM

Binding a TreeView control to a hierarchical data structure, Part I

4/8/2010 by Samir NIGAM · 0 · 8947

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...

Samir NIGAM

Emulating IE7 in IE8 – By adding the Meta tag programmatically

12/29/2009 by Samir NIGAM · 0 · 1612

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...

Samir NIGAM

Emulating IE7 in IE8 – By defining a Custom Header in Web.Config file

12/29/2009 by Samir NIGAM · 0 · 3073

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...

Samir NIGAM

Emulating IE7 in IE8 – By adding a Meta tag within the head tag on all the pages

12/28/2009 by Samir NIGAM · 0 · 2361

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" ...

Samir NIGAM

Emulating IE7 in IE8 – By adding a Http Header in IIS

12/28/2009 by Samir NIGAM · 0 · 7276

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 , ...

Raghav Khunger

Disable enable checkboxes on click of other checkbox

11/18/2010 by Raghav Khunger · 0 · 4532

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...

Raghav Khunger

How to select records falling between two dates

12/27/2009 by Raghav Khunger · 0 · 1868

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...

Raghav Khunger

How to add two numbers with javascript

12/27/2009 by Raghav Khunger · 0 · 11857

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...

Raghav Khunger

How to remove link line from hyperlink

12/27/2009 by Raghav Khunger · 0 · 2416

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...

Raghav Khunger

How to retrieve identity value of last inserted record

12/27/2009 by Raghav Khunger · 0 · 2308

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 ---------------------------------------...

Raghav Khunger

Validate atleast one checkbox is checked in checkboxlists

12/27/2009 by Raghav Khunger · 0 · 2924

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> ...

Raghav Khunger

Delete a record from database using ADO.NET

12/27/2009 by Raghav Khunger · 0 · 2115

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...

Raghav Khunger

How to get average of records in SQL

12/26/2009 by Raghav Khunger · 0 · 1333

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...

Raghav Khunger

Check uncheck all checkboxes in Gridview

8/20/2010 by Raghav Khunger · 0 · 8668

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 ...

Raghav Khunger

How to select data from multiple tables in SQL

12/26/2009 by Raghav Khunger · 0 · 2023

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' ...

Raghav Khunger

How to open a div on click of hyperlink

12/26/2009 by Raghav Khunger · 0 · 5142

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> ...

Raghav Khunger

Change the forecolor property of a control in code behind

12/26/2009 by Raghav Khunger · 1 · 2937

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...

Raghav Khunger

Check uncheck all checkboxes in Repeater

12/26/2009 by Raghav Khunger · 0 · 6122

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 ...

Raghav Khunger

How to use ResolveUrl with link tag

12/26/2009 by Raghav Khunger · 0 · 3009

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...

Raghav Khunger

How to find maximum and minimum of each group

12/26/2009 by Raghav Khunger · 0 · 884

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 @...

Raghav Khunger

Check uncheck all checkboxes in Datalist

12/26/2009 by Raghav Khunger · 0 · 3950

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 ...

Raghav Khunger

Get records greater than today

12/26/2009 by Raghav Khunger · 0 · 707

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...

Raghav Khunger

SQL: How to change the column datatype

12/26/2009 by Raghav Khunger · 0 · 1936

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 ...

Raghav Khunger

How to pass table name dynamically

12/26/2009 by Raghav Khunger · 0 · 1206

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...

  • Page 1 of 2 (28 items)
  • « Previous 
  • 1
  • 2
  • Next »
  •   Go to page:  [Go]

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

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:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?