Friday 28 March 2014

how to count number of online users in asp.net

Simple two steps:

1.Add this code in Global.asax


void Application_Start(Object Sender, EventArgs E)
        {
            Application["CurrentUsers"] = 0;
        }
        void Session_OnStart(object Sender, EventArgs E)
        {
            Application.Lock();
            Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) + 1;
            Application.UnLock();
        }
        void Session_OnEnd(object Sender, EventArgs E)
        {
            Application.Lock();
            Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) - 1;
            Application.UnLock();
        }

2.In Aspx Page

<%=Application["CurrentUsers"].ToString()%>

In web.config timeout will be make 10, by default 20

Friday 21 March 2014

hex code for checkbox and apply to css

HEX Code for check box is :
                         Checked :2610,
                    Un Checked :2611.

In Css
.checked:before
{
    content:"\2611";
    }
in Aspx page or html page or View

<a href="#" class="checked"></a>

Tuesday 11 March 2014

dynamic menu li selected item highlighted using jquery or javascript

Use the following steps for archiving li selected item highlited.

Loop Code :1

@foreach (class obj in list)
        {
            <ul>
                <li  class="@obj.strName" style="font-weight:bold;" ><a href="#"  style="text-decoration:none;" >
 </a></li>
            </ul>
        }

Css: 2
.li
    {      
        background-color:#bb0d2d !important;
        color: white !important;      
    }

JQuery: 3
$('li').click(function () {
        $(this).addClass('li');
    });

Wednesday 5 March 2014

default button in html using jquery

use this steps:
Html or aspx or View
create textbox and button in the page and assign id,

Then,

JQUERY

$("#textboxID").keyup(function (event) {
        if (event.keyCode == 13) {
            $("#buttonID").click();
        }
    });