Loading ...

TrustedBlogs

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

Communifire Blogs

Raghav Khunger : Most Recent postings

Raghav Khunger

jQuery: How to disable buttons on clicking any one of them

6/18/2010 by Raghav Khunger · 0 · 1796

In this blog I will show you how to disable buttons on clicking any of them with the help of jQuery. To show it I have posted a sample code below in which I have used two input buttons. On clicking either the first or second button both of the buttons will be disabled. Here is the source code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <...

Raghav Khunger

ASP.NET: How to concatenate checkboxlist values as comma separated

6/18/2010 by Raghav Khunger · 2 · 4290

In this blog I will show you how to concatenate checkboxlist values as comma separated in ASP.NET. To show it I have posted a sample code below in which I have used a checkboxlist, one button and one label. On clicking the button the values of the checkboxes which are selected will be concatenated and will displayed in the label in form of comma separated string . Here is the source code...

Raghav Khunger

jQuery: How to enable disable textbox

6/18/2010 by Raghav Khunger · 0 · 9335

In this blog I will show you how to enable or disable a textbox with the help of jQuery. To show it I have posted a sample code below in which I have used one textbox and two input buttons. On clicking the first button the textbox will be disabled and on clicking the second button the textbox will be enabled. Here is the source code: <html xmlns="http://www.w3.org/1999/xhtml"> <...

Raghav Khunger

jQuery: How to show a message bar at the top of browser window

6/11/2010 by Raghav Khunger · 1 · 8746

In this blog i will explain you how to show a pop message at the top of browser window with jQuery. There are requirements when we want to show the user some message in the form of pop up. Sometimes it doesn't feel good to show alert boxes there is a nice way to show the messages which I am going to show. Below is the screenshot how the message will look. Here is the code snippet: <ht...

Raghav Khunger

How to escape single quotes in c# so that the string can be used in Javascript

6/3/2010 by Raghav Khunger · 3 · 35256

In this blog I will show you how to how to escape single quotes in c# so that the string can be used in javascript. Many times we need to pass the string from c# to some javascript function argument and if that string contains single quote or double quote it can cause issue on the javascript side and you can encounter this famous 'Unterminated String constant' error . So what is the solu...

Raghav Khunger

jQuery: How to remove all the classes from a selector

6/3/2010 by Raghav Khunger · 0 · 2474

In this blog I will show you how to remove all the classes from a control with jQuery. Few days back a person on forums asked the same question and so I decided to blog for it. In this example I have used a div which is associated with two classes '.notice' and '.warning' , there is an input button too. On clicking the input button the classes of that div will be removed. Below is the so...

Raghav Khunger

jQuery: Redirect to other URL

6/3/2010 by Raghav Khunger · 0 · 43985

In this blog I will show you how to redirect to other URL or page with jQuery. To show it I have posted a sample code below. In this example I have used an input button, on clicking on that input button you will be redirected to external URL. Below is the source code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascri...

Raghav Khunger

jQuery: How to select an element on the basis of multiple attributes

6/3/2010 by Raghav Khunger · 0 · 2522

In this blog I am going to show how to select an element based on multiple attributes with jquery. You must be very well aware of selecting on the basis of single element but sometimes we have a requirement to select on the basis of multiple attributes. To show it I have used five anchors in my example with id a1, a2, a3, a4 , a5 . Now our goal will be to select those elements which cont...

Raghav Khunger

jQuery: How to select all those anchors which contains # as href

6/3/2010 by Raghav Khunger · 0 · 2357

In this blog I am going to show how to select all those anchors which are having # as their href with jquery. I have used five anchors in my example with id a1, a2, a3, a4 , a5 . Now out of these five anchors three are having # as their href. The heart of the code is $('a[href=\'#\']') by which I am selecting the desired anchors. Below is the source code: <html xmlns="http://www.w3.or...

Raghav Khunger

How to get list of all tables in SQL

5/16/2010 by Raghav Khunger · 0 · 2118

Normal 0 false false false EN-US X-NONE X-NONE Today I was working in my database and I was in a need to get the list of all the the tables in my database. I thought I should write a quick blog for it. Below is the script to list all the tables. SELECT [Name] AS [TableName] FROM SYS.SYSOBJECTS WHERE XTYPE='U' ORDER BY [Name] Here is the screen shot which I got when I run the same query i...

Raghav Khunger

Generate N digit alphanumeric string in SQL

5/16/2010 by Raghav Khunger · 0 · 4134

Today I was in a need to make a function which can generate random n digit alphanumeric string of desired length in SQL. I am writing this blog to show what I did to accomplish the same. The function accepts one parameter of integer type and will return the desired length alphanumeric output. The input parameter represents the length of the alphanumeric string which is desired . Below is...

Raghav Khunger

How to find the list of foreign keys of all the tables

5/13/2010 by Raghav Khunger · 0 · 1117

Two days back a person was asking on the forums on how to find the list of foreign keys of all the tables in the database. I am writing this blog for it and have mentioned two ways to do so. First : SELECT FK.NAME AS FOREIGNKEY , OBJECT_NAME(FK.PARENT_OBJECT_ID) AS TABLENAME , COL_NAME(FKC.PARENT_OBJECT_ID, FKC.PARENT_COLUMN_ID) AS COLUMNNAME , OBJECT_NAME(FK.REFERENCED_OBJECT_ID) AS REF...

Raghav Khunger

Change the operating system name on Windows boot

5/1/2010 by Raghav Khunger · 0 · 2747

Yesterday I installed VHD of Windows7 on my laptop. After that I had two OS loaded on my machine one which was present earlier and second one of VHD. As soon I start restarted my machine after installing VHD. I was invited with this screen. As you saw I got two similar names which was putting me in dilemma. For this case I was able to enter my VHD by hit and trial as I selected the first...

Raghav Khunger

Find number of rows in each table in SQL

4/28/2010 by Raghav Khunger · 0 · 2911

One of the person was asking on forums about how to find the number of rows in each table in SQL. So I am writing this blog and showing the script will give you a list of tables with count of rows. Here is the script : DECLARE @temp TABLE ([TableName] VARCHAR(255),[NumberOfRows] BIGINT) INSERT INTO @temp EXEC sp_MSForEachtable 'SELECT ''?'',COUNT(*) FROM ?' SELECT * FROM @temp ORDER BY T...

Raghav Khunger

Find space used by each table in SQL

4/28/2010 by Raghav Khunger · 0 · 1872

One of the person was asking on forums about how to find the space used by each table in SQL. So I am writing this blog and showing the script will give you a list of tables with spaces used by them. Here is the script : DECLARE @temp TABLE ([TableName] VARCHAR(200),[NumberOfRows] BIGINT,[Reserved] VARCHAR(20), [Data] VARCHAR(20),[Index_Size] VARCHAR(20),[Unused] VARCHAR(20)) INSERT INTO...

Raghav Khunger

Select distinct records from a collection

4/5/2010 by Raghav Khunger · 0 · 2875

Today my teammate had a requirement to select distinct records from a collection. He was getting duplicate records in his collection; the collection was made of objects of a class having a number of properties. Now his goal was to select distinct records only out of those duplicate records. I decided to go for a custom comparer for this purpose and with the help of custom comparer along ...

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

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

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?