Wednesday, June 20, 2012

How to store and retrive json from localstorage.

localStorage only supports strings. Use JSON.stringify() and JSON.parse().

--save json in localstorage
var hash={};
localStorage['hash']=JSON.stringify(hash);

--retrive json from localstorage
var jsonObj=JSON.parse(localStorage['hash']);

Friday, December 23, 2011

How to Enable Database and table For SQLCacheDependency

Start Visual Studio Command Prompt and enter these commands for enable sqlcachedependency in your application
for enabling a database
for enabling a database
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -ed

for diUserNamebling a database
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -dd

for enabling a table
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -t Table -et

for diUserNamebling a table
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -t Table-dt

for listing tables
aspnet_regsql -S ServerName -U UserName -P Password -d DataBase -lt

Friday, July 8, 2011

How to generate proxy class from a web service in asp .net?

open visual studio command prompt and go to root directory and write this command and press enter. MyProxyClass.cs will be created in your root directory.
WseWsdl3 http://hostServer/WebServiceRoot/WebServiceName.asmx?WSDL /out:MyProxyClass.cs

How to show sum at footer in Gridview.

Generally to show sum at footer in GridView we use. GridView's RowDataBound Event. We Create a variable(float/Int) outside of event.
and in RowDataBound Event we check row type. if row type is DataRow than we find the Cell's Text convert it into int and Add it to variable created outside of RowDataBound Event. and When RowType change from DataRow to Footer Row than we put that variable's value in footer.
But i want to tell you short and sweet method for it.
as all of you know generally we use DataTable as  datasource in gridview.
than we should use it
string str = dt.Compute("sum(sGrandTotal)", "").ToString();
now just find the Footer of gridview and put str variable in the cell. like this
grdReport.FooterRow.Cells[7].Text = "Total" + float.Parse(str).ToString( "N2");

How to delete duplicate records from a table ?

delete t1
from tblTable t1, tblTable t2
where t1.sName = t2.sName
and t1.uniqueField > t2.uniqueField
where t1.uniqueFiled should be int

Sunday, June 12, 2011

How to Enable Service Broker on SQL Server 2005 ?

You can check to see whether the Service Broker is enabled on your server by executing the following SQL syntax:
SELECT name, is_broker_enabled FROM sys.databases where name='YourDBName'
To enable the Service Broker on your database, you must execute the ALTER DATABASE command. The following SQL command will enable the Service Broker service on the your database:
ALTER DATABASE YourDBName SET ENABLE_BROKER

Tuesday, June 7, 2011

Add Hindi or Phonetic Typing to your web page

hi friends generally we use google translate to type hindi or other language
in textboxes or other text editor tool.
by using this code we can directly type in engish which automatically converted to hindi or any language which we set in java script code.
    
    

change destinationLanguage to google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.TAMIL
or other language which google support.