Feb 24, 2012

Enum Examples or How to Bind the DropDownList With Enum?

2 comments
Enum is the type provided by dotnet, it stores constant value in it. When we want to specify some constant value to use in the project then it is very usefull for readability.

In this post I will show you how to declare an enum and how to use it in the program.
Here I have bind the enum to the dropdown list

Declare the enum as below

public enum Days { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }

In aspx page I have added DropDownList named ddlDays as below

 <asp:DropDownList ID="ddlDays" runat="server">
        </asp:DropDownList>

Now below is the code to bind dropdownlist control with above enum
// Add first item to the drop down list to select lable
        ddlDays.Items.Add("--Select Days--");

        string[] enumNames = Enum.GetNames(typeof(Days));
        foreach (string item in enumNames)
        {
            int value = (int)Enum.Parse(typeof(Days), item);
            ListItem listItem = new ListItem(item, value.ToString());
            //Add one by one item to the drop down list
            ddlDays.Items.Add(listItem);
        }
 













Out put is displayed in the side image.

read more

Feb 14, 2012

Supported languages by SyntaxHighlighter

comments
Syntax highlighter is a tool which will highlight the code in correct Syntax. When on your blog or web site you want to show some programming code then it is very useful.


In my next post I will show you how to add Syntax Highlighter in blogger or any webpage.

Below is the list of all the supported languages with their aliases.






Language Aliases
C++ cpp, c, c++
C# c#, c-sharp, csharp
CSS css
Delphi delphi, pascal
Java java
Java Script js, jscript, javascript
PHP php
Python py, python
Ruby rb, ruby, rails, ror
Sql sql
VB vb, vb.net
XML/HTML xml, html, xhtml, xslt

For more detail visit: http://code.google.com/p/syntaxhighlighter/wiki/Languages

read more

Feb 12, 2012

Change cursor to hand on mouseover using jQuery

4 comments
When ever we need to change the mouse cursor using JQuery then we can do it very easily.

In my today's post I will show you how can we change the mouse cursor to the Hand type cursor while user hover mouse on the particular element.
It is very simple just look at the below JQuery code.
   




$(document).ready(function() {
  $("#elementid").hover(function() {
    $(this).css("cursor", "hand");
  });
});

In above code 'elementid' is the name of the element on which you want a mouse pointer as a hand while hovering a mouse over it.

Happy Coding...

read more

Author Profile

Total Pageviews

Categories

Followers

 
Top Programming   Sites Technology Top Blogs Technology blogs Technology Blogs

Sponsors