Dec 17, 2010

How to change css style in ValidatorCalloutExtender.

You can design validator call out as per your site theme.

please follow when ever required.


/*call out CSS starts */

.customCalloutStyle div, .customCalloutStyle td{
border: solid 1px Black;
background-color:#8B6725;
color:White;
font-family:Tahoma, Geneva, sans-serif;
}
.customCalloutStyle .ajax__validatorcallout_popup_
table{
display: none;
border: none;
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_popup_table_row{
vertical-align: top;
height: 100%;
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_callout_cell{
width: 20px;
height: 100%;
text-align: right;
vertical-align: top;
border: none;
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_callout_table{
height: 100%;
border: none;
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_callout_table_row{
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_callout_arrow_cell
{
padding: 8px 0px 0px 0px;
text-align: right;
vertical-align: top;
font-size: 1px;
border: none;
background-color: transparent;
}
.customCalloutStyle .ajax__validatorcallout_callout_arrow_cell .ajax__validatorcallout_innerdiv{
font-size: 1px;
position: relative;
left: 1px;
border-bottom: none;
border-right: none;
border-left: none;
width: 15px;
background-color: transparent;
padding: 0px;
}
.customCalloutStyle .ajax__validatorcallout_callout_arrow_cell .ajax__validatorcallout_innerdiv div{
height: 1px;
overflow: hidden;
border-top: none;
border-bottom: none;
border-right: none;
padding: 0px;
margin-left: auto;
}
.customCalloutStyle .ajax__validatorcallout_error_message_cell
{
font-family: Tahoma;
font-size: 11px;
padding: 5px;
border-right: none;
border-left: none;
width: 100%;
}
.customCalloutStyle .ajax__validatorcallout_icon_cell{
width: 20px;
padding: 5px;
border-right: none;
}
.customCalloutStyle .ajax__validatorcallout_close_button_cell{
vertical-align: top;
padding: 0px;
text-align: right;
border-left: none;
}
.customCalloutStyle .ajax__validatorcallout_close_button_cell .ajax__validatorcallout_innerdiv{
border: none;
text-align: center;
width: 10px;
padding: 1px;
cursor: pointer;
}
/* call out CSS end */


//Call out HTML
RequiredFieldValidator21"
CssClass="customCalloutStyle" WarningIconImageUrl="images/001_111.png" CloseImageUrl="images/001_051.png">
ValidatorCalloutExtender>

//For IE put below

<!--[if IE]>
< link rel="stylesheet" type="text/css" href="css/ie.css" / >
< ![endif]-->

/* css for ie */

.divborder{border:1px solid #d0cece; width:763px; float:left; margin:0 0 0 2px; padding:10px 0 10px 5px;}
.customCalloutStyle .ajax__validatorcallout_close_button_cell .ajax__validatorcallout_innerdiv img{
border: none;
text-align: center;
width: 25px;
padding: 1px;
cursor: pointer;
z-index:9999;
position:absolute;
right:-13px;
background:none;
}

/* end css for ie */

Dec 16, 2010

Get timezone using asp.net

using System;
using System.Collections.ObjectModel;

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
lblLocalTime.Text = DateTime.Now.ToString();
ReadOnlyCollection tzi;
tzi = TimeZoneInfo.GetSystemTimeZones();
foreach (TimeZoneInfo timeZone in tzi)
{
ddlTimeZone.Items.Add(new ListItem(timeZone.DisplayName, timeZone.Id));
}
}
}

protected void ddlTimeZone_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlTimeZone.SelectedIndex > 0)
{
DateTime dt = DateTime.Now;
lblTimeZone.Text = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt,
TimeZoneInfo.Local.Id, ddlTimeZone.SelectedValue).ToString();
}
}

Dec 9, 2010

detect javascript disabled asp.net

Hello Friends,

I searched for a way to determine if the user's web browser was running JavaScript, but discovered most samples on the net only detected if the browser was capable of running JavaScript. It did nothing to detect (at least from C#) whether JavaScript was currently enabled.

I finally got some good code for detect javascript enable/disable using asp.net.

http://www.sendspace.com/file/zjbbe1

I hope you getting some good output.

Dec 8, 2010

Price format using store procedure in sql server

CREATE FUNCTION [dbo].[format_currency] (@monetary_value money ) returns varchar(20)
as
begin
declare @return_value varchar(20)
declare @is_negative bit
select @is_negative = case when @monetary_value<0 then 1 else 0 end

if @is_negative = 1
set @monetary_value = -1*@monetary_value

set @return_value = convert(varchar, isnull(@monetary_value, 0))

declare @before varchar(20), @after varchar(20)

if charindex ('.', @return_value )>0
begin
set @after= substring(@return_value, charindex ('.', @return_value ), len(@return_value))
set @before= substring(@return_value,1, charindex ('.', @return_value )-1)
end
else
begin
set @before = @return_value
set @after=''
end
-- after every third character:
declare @i int
if len(@before)>3
begin
set @i = 3
while @i>1 and @i < len(@before)
begin
set @before = substring(@before,1,len(@before)-@i) + ',' + right(@before,@i)
set @i = @i + 4
end
end
set @return_value = @before + @after

if @is_negative = 1
set @return_value = '-' + @return_value

return '$' +@return_value
end

Dec 6, 2010

Auto complete CSS in asp.net

Please find below CSS and HTML for autocompltet extender please use as needed...

also please change color as per your color scheme

For Autoextender CSS

/*auto extender starts */



.AutoCompleteExtender_
CompletionList
{
background-color : window; color : windowtext; padding : 1px; font-size: 12px; background-color:Gray;
/*creates border with autocomplete_completionListElement background-color*/
}

/*AutoComplete flyout */
.AutoCompleteExtender_CompletionListItem
{text-align : left; background-color:White;}

/* AutoComplete highlighted item */
.AutoCompleteExtender_HighlightedItem { background-color: Silver; color: windowtext; font-weight:bold; font-size: small;}




.AutoExtender
{
font-family: arial;
font-size: 12px;
font-weight: normal;
border: solid 1px #419448;
line-height: 20px;
padding: 10px;
background-color: White;
margin-left:0px;
margin:0px;

}
.AutoExtenderList
{
border-bottom: dotted 1px #419448;
cursor: pointer;
color: #144a19;
}
.AutoExtenderHighlight
{
color: White;
background-color: #714F10;
cursor: pointer;
}
#divwidth
{
width: 150px !important;
}
#divwidth div
{
width: 150px !important;
}

/*auto extender CSS ends */


//auto compltet extender HTML
CompletionSetCount="20" EnableCaching="false" FirstRowSelected="True" MinimumPrefixLength="1"
ServiceMethod="GetSuburbTest" ServicePath="WebService.asmx" TargetControlID="txtBillSuburb"
CompletionListCssClass="AutoExtender"
CompletionListItemCssClass="AutoExtenderList"
CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
CompletionListElementID="divwidth">