Thursday, October 28, 2010

Needed

I want to integrate Bombay Stock Exchange Quates in my Website in asp.net. please any one suggest me

Monday, July 26, 2010

Difference between ‘==’ and ‘===’ operator in JavaScript

Check Below two javascript functions

function testEqualfn()
{
var a = 10;
var b = "10";
if (a == b)
{
alert("They are equal");
} else {
alert("They are not equal");
}
}

function testTripleEqualfn()
{
var a = 10;
var b = "10";
if (a === b) {
alert("They are equal");
} else {
alert("They are not equal");
}

So, why "10" and 10 are equal when using == operator and not equal when using === operator.

Please find below reasons for operators.

"==" operator compares only the values of the variables. If the types are different a conversion is operated. So the number 10 is converted to the string "10" and the result is compared.

"===" operator compares not only the values but also the types, so no cast is operated. In this case "10" !== 10

Monday, June 14, 2010

Call page method in javascript

1) create one function

public string getMenu()
{
return (Functions.GetPath() + "/js/jqueryq.js");
}

2) Add function name to Design

script type="text/javascript" language="javascript" src='<%= getMenu() %>' /script

Wednesday, April 28, 2010

Highlight Textbox onfocus

Step -1 Add below Css in Head tag of Html.

.input_text
{ border:1px solid #cEcEcE;
padding:4px;
font-size:14px;
color:#000000;
background-color:#ffffff;
}

.input_text:focus, input.input_text_focus
{
border-color:#646464; background-color:#ffffc0;
}


Step-2 Add Below Javascript for Hovr/Out text box

setAspnetTextFocus = function() {

var classBlur = 'input_text';
var classFocus = 'input_text_focus';
var inputElements = document.getElementsByTagName('input');

for (var i = 0; i < inputElements.length; i++) {
inputElements[i].onfocus = function() {
if (this.className == 'input_text') {
this.className += ' ' + classFocus;
} }
inputElements[i].onblur = function() {
this.className = this.className.replace(new RegExp(' ' + classFocus + '\\b'), '');
} } }

if (window.attachEvent) window.attachEvent('onload', setAspnetTextFocus);

Step -3 Add CSS to text box

ID="TextBox1" runat="server" CssClass="input_text"

Monday, April 19, 2010

Filter Rows from Dataset

Filter Rows from dataset

Step - 1 Convert Datatable to Dataview

DataTable dt = ViewState["MyDataTable"] as DataTable;
DataView dvMyDataTable = dt.DefaultView;

Step - 2 Apply filter conditions in dataview

dvMyDataTable.RowFilter = "DatatableField_Name = " + "My Name";

Step - 3 save data after filter

dt.AcceptChanges();

Tuesday, March 2, 2010

Safari Compatibility patch for WebKit for AJEX

'asp:ScriptReference Path="~/scripts/SafariHackCode.js"' Add reference to SafariHackCode.Js in Script manager

create SafariHackCode js with following code

Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit
if( navigator.userAgent.indexOf( 'WebKit/' ) > -1 )
{
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.version = parseFloat( navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = 'WebKit';
}