Tuesday, May 26, 2009

Java script for button control in code behind in asp.net

protected void Page_Load(object sender, EventArgs e)
{
btnFirst.Attributes.Add("onmouseover", "this.className='handCursor';");
btnFirst.Attributes.Add("onmouseout", "this.className='defaultCursor';");
btnPrev.Attributes.Add("onmouseover", "this.className='handCursor';");
btnPrev.Attributes.Add("onmouseout", "this.className='defaultCursor';");
btnNext.Attributes.Add("onmouseover", "this.className='handCursor';");
btnNext.Attributes.Add("onmouseout", "this.className='defaultCursor';");
btnLast.Attributes.Add("onmouseover", "this.className='handCursor';");
btnLast.Attributes.Add("onmouseout", "this.className='defaultCursor';");

if (!Page.IsPostBack)
{
}
}

CSS functions

.handCursor
{
cursor:hand;
color:Orange;
background-color:Transparent;
border-left-color: transparent;
border-bottom-color: transparent;
border-top-style: none;
border-top-color: transparent;
border-right-style: none;
border-left-style: none;
border-bottom-style:none;
border-right-color: transparent;
font:Arial;
font-size:11pt;
font-weight:bold;

}
.defaultCursor
{
cursor:default;
background-color:Transparent;
border-left-color: transparent;
border-bottom-color: transparent;
border-top-style: none;
border-top-color: transparent;
border-right-style: none;
border-left-style: none;
border-bottom-style:none;
border-right-color: transparent;
color:Teal;
font:Arial;
font-size:12pt;
font-weight:bold;
}

No comments: