Loading ...

TrustedBlogs

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

Communifire Blogs

Raghav Khunger : Most Recent postings

Raghav Khunger

Adding line break on div in code behind

11/7/2009 by Raghav Khunger · 0 · 8818

In this blog I will explain how add line break through cod behind. The main heart of the code is LiteralControl("<br/>") In Aspx <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div runat="server" id="TestDiv"> </div> <asp:Button runat="server" ...

Raghav Khunger

Stack and Queue Generics

10/29/2009 by Raghav Khunger · 0 · 1475

In this blog I will show the demonstration of stack and queue generics. Stack follows the last in, first out (LIFO) principle. Queue follows the first in, first out (FIFO) principle. They are used when we have to add or fetch items in particular order. Below is the code : Stack Generic using System; using System.Collections.Generic; namespace TestConsole { class TestStackGeneric { static...

Raghav Khunger

How to add item to dropdownlist after databind

10/27/2009 by Raghav Khunger · 0 · 8522

In this blog I will explain how to add item to dropdownlist after databind. I am talking about the scenario where we have bind the dropdownlist with some datasource and after binding the data we want to insert an item to dropdownlist in most cases at first option. Below is the code: The heart of the code is at: myDropdownList.Items.Insert(0,new ListItem("-- Please Select --","0")); In As...

Raghav Khunger

How to match exact word in a string

10/27/2009 by Raghav Khunger · 0 · 2685

In this blog I will explain how to match exact word in a string. I have used regular expression to match the exact word. Below is the code: Regex.IsMatch(testString, string.Format(@"\b{0}\b", wordToBeMatch)) I will explain it with two examples. Example 1 using System; using System.Text.RegularExpressions; namespace TestConsole { class SearchExactWord { static void Main(string[] args) { s...

Raghav Khunger

How to merge two arrays in javascript

10/17/2009 by Raghav Khunger · 2 · 2997

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 In this blog I will explain how to merge two arrays together. Suppose I have one array with n items and other array with m items so our goal is to merge these two arrays in a common array but this common array should have unique records after merging of these two arrays. I have used jquery merge method to implement...

Raghav Khunger

How to sort a list in C#

10/17/2009 by Raghav Khunger · 0 · 1471

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 In this blog I will explain how to sort a list .Below a custom comparer is used NameComparer , which implements IComparer interface.In below example I am explaining with list which contains collection of strings.Here is the code: using System; using System.Collections.Generic; /// <summary> /// /// </summa...

Raghav Khunger

How to get all namespaces of an assembly

10/16/2009 by Raghav Khunger · 0 · 2242

In this blog I will explain how to get all namespaces of an assembly. I have used linq to get that work. I will explain a example for getting all namespaces of mscorlib assembly. using System; using System.Linq; using System.Reflection; public class Program { static void Main(string[] args) { //GET ASSEMBLY var assembly = Assembly.GetAssembly(typeof(string)); //GET NAMESPACES var namespa...

Raghav Khunger

Z index issue with flash swf object

10/16/2009 by Raghav Khunger · 1 · 4667

In this blog I will discuss the zindex issue with swf object. While using swf object in javascript there are situations when the flash object comes on the top of other controls for example dropdownlist ,textboxes etc. So to avoid this I have added one more attribute to swf object sObject .addParam ("wmode", "transparent"); Here is the code snippet: <html xmlns="http://www.w3.org/1999/...

Raghav Khunger

Hide and show div on click of checkbox with jquery

10/9/2009 by Raghav Khunger · 1 · 9336

In this blog I will explain how to hide and show div on click of checkbox with jQuery. To explain it I have used one checkbox and a div tag. If the checkbox is checked then the div is made visible and if the checkbox is unchecked the div tags is made hidden. Below is the code snippet: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title>...

Raghav Khunger

How to slide down and slide up a div with jQuery

10/9/2009 by Raghav Khunger · 0 · 4274

In this blog I will explain how to slide down and slide up a div with jQuery. To explain it I have used one two buttons and a div tag. On click of first button the div gets slide down and on click of second button the div gets slide up. Below is the code snippet: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1"> <title></title> <script type="text/ja...

Raghav Khunger

How to get content type of a file in C#

10/9/2009 by Raghav Khunger · 0 · 23243

In this blog I will explain how to get content type of a file in C# . I have wrapped the code in GetContentType method.This method will accept the file name and will return the content type of the file. Below is the code snippet: using System; public partial class _Default : System.Web.UI. Page { protected void Page_Load( object sender, EventArgs e) { string textFile= "C:\\test.txt" ; st...

Raghav Khunger

How to check with regex if a particular sequence exists at the last of a string

10/9/2009 by Raghav Khunger · 0 · 2387

In this blog I will explain how to check with regular expression (regex) if a particular sequence exists at the last of a string. Below is the code snippet: using System; using System.Text.RegularExpressions; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string pattern = "string!!$"; //First Example string inputString = "This ...

Raghav Khunger

how to fadein and fadeout a div with jQuery

10/9/2009 by Raghav Khunger · 5 · 7690

In this blog I will explain how to fade in and fadeout a div with jQuery. To explain it I have used one two buttons and a div tag. On click of first button the div gets fade in and on click of second button the div gets fade out. Below is the code snippet: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1"> <title></title> <script type="text/javascrip...

Raghav Khunger

How to get all ids of div tags in particular div

9/27/2009 by Raghav Khunger · 0 · 3271

In this blog I will explain how to get all ids of div tags in particular div ,means to get all controls id in a particular element. I have used map method of jQuery. Below is the code snippet for it: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1...

Raghav Khunger

How to bind events to controls except one control with jQuery

9/27/2009 by Raghav Khunger · 0 · 2313

In this blog I will explain how to bind events to controls except one control with jQuery .In some requirements we have to bind a event suppose keydown to all textboxes except a particular textbox and on that particular textbox we want to have different functionality on keydown event. Below is the code snippet for it: < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="...

Raghav Khunger

Escaping single quote with regex

9/27/2009 by Raghav Khunger · 0 · 9333

In this blog I will explain how to escape single quotes with regular expression in javascript. There are issues when we have single quotes with in string in javascript. Below is the code snippet. Escaping only one single quote. < html xmlns ="http://www.w3.org/1999/xhtml"> < head id ="Head1" > < title ></ title > </ head > < body > < div > </ ...

Raghav Khunger

SQL: How to rename a column name

9/27/2009 by Raghav Khunger · 0 · 3025

In this blog I will show you how to rename a column name in sql. The syntax for renaming the column is EXEC SP_RENAME @objname = 'table_name.old_column_name', @newname = 'new_column_name', @objtype = 'COLUMN' According to the msdn: "sp_rename" Changes the name of a user-created object in the current database. This object can be a table, index, column, alias data type, or Microsoft .NET F...

Raghav Khunger

Difference between obj.ToString() vs Convert.ToString(obj) vs (string)obj vs obj as string

9/26/2009 by Raghav Khunger · 4 · 5738

In this blog i will explain the difference between obj.ToString() vs Convert.ToString(obj) vs (string)obj vs obj as string obj.ToString() .ToString() can be called from any object. It returns a string that represents the current Object. ToString() is a method of object, and it will always work on a non-null reference. For example: object str = "test string" ; string newTestString = str.T...

Raghav Khunger

How to check directory exists

9/5/2009 by Raghav Khunger · 0 · 1609

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how check a directory exists or not.I have used Directory class Exists method to explain it.Below is the code snippet. using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main( string [] args) { bool folderExists = Directory .Exists( @"c:\windows" ); } } } Above i have passed...

Raghav Khunger

Hide mouse cursor with jquery

9/5/2009 by Raghav Khunger · 0 · 12433

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how to hide mouse cursor with jQuery. I am explaining with an example where we have to hide mouse cursor when mouse is over a particular div below is the code snippet to explain it. < html xmlns ="http://www.w3.org/1999/xhtml"> < head > < title ></ title > < script type ="text/javascript...

Raghav Khunger

Convert scientific number to floating point number.

9/5/2009 by Raghav Khunger · 0 · 1898

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 In this blog I will explain how to convert scientific number to floating point number. I have used one of the overloaded method of Double.Parse. Below is the code snippet: using System; using System.Globalization; namespace ConsoleApplication1 { class Program { static void Main( string [] args) { double number= Dou...

Raghav Khunger

How to make a input field readonly with jQuery

9/5/2009 by Raghav Khunger · 0 · 12483

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how to make a input field readonly with jQuery.Below is the code snippet: < html xmlns ="http://www.w3.org/1999/xhtml"> < head > < title ></ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></ script > </ head >...

Raghav Khunger

How to check a website folder exists or not

9/5/2009 by Raghav Khunger · 0 · 2402

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how check a website folder exists or not.I have used Directory class Exists method to explain it.Below is the code snippet. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO ; public partial class How_to_chek_a...

Raghav Khunger

How to refresh a page using jQuery

8/25/2009 by Raghav Khunger · 0 · 5711

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how to Refresh a Page using jQuery.I have used location.reload() for that .Below is the code snippet: < html xmlns ="http://www.w3.org/1999/xhtml"> < head > < title ></ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"><...

Raghav Khunger

Image slide show using jQuery

8/25/2009 by Raghav Khunger · 0 · 4430

Normal 0 false false false EN-US X-NONE X-NONE In this blog I will explain how to make image slide show using jQuery. < html xmlns ="http://www.w3.org/1999/xhtml"> < head > < title ></ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></ script > </ head > < body > < img id ="...

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?