Loading ...

TrustedBlogs

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

Communifire Blogs

Raghav Khunger :December 2009 postings

Raghav Khunger

Disable enable checkboxes on click of other checkbox

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

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 1 (19 items)

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?