Posts

Cookies in ASP.NET

Cookies is a small piece of information stored on the client machine. This file is located on client machines "C:\Document and Settings\Currently_Login user\Cookie" path.  Its is used to store user preference information like Username, Password,City and PhoneNo etc on client machines. We need to import namespace called  Systen.Web.HttpCookie before we use cookie. Type of Cookies? Persist Cookie - A cookie has not have expired time Which is called as Persist Cookie Non-Persist Cookie - A cookie has expired time Which is called as Non-Persist Cookie How to create a cookie?  Its really easy to create a cookie in the Asp.Net with help of Response object or HttpCookie Example 1 :             HttpCookie  userInfo =  new   HttpCookie ( "userInfo" );         userInfo[ "UserName" ] =  "Annathurai" ;         userInfo[ "UserColor"...

Alert Message using C#

Alert Message Using C# in ASP.NET  --------------------- Method 1 ScriptManager .RegisterClientScriptBlock( this , this .GetType(), "alertMessage" , "alert('Your Selected AccountID is : " + AccountID + "')" , true ); -------------------- Method 2 ClientScript.RegisterStartupScript ( this .GetType(), "alert" , "alert('Insert is successfull')" , true ); 

Calculate Simple Interest

Calculate Simple Intersert  Calculate Simple Interest in Sql Server 2008 DECLARE @P float ; DECLARE @R float ; DECLARE @T float ; DECLARE @SI float ;     set @P = 50000 ;     set @R = 05;     set @T = 05;     set @SI = @P*@R*@T/100     select @SI as 'Simple Interest'   Calculate Compound Interest select @P* POWER ((1+@R/100),@T)-@P as 'compoundInterest'  
Image
WRITE ON GOOGLE CHROME LIKE NOTEPAD PASTE THIS URL IN CHROME BROWSER : AND WRITE LIKE NOTE PADE ;)
Remove HTML Tages from Datatable In C# First Create This Function.  Public string RemoveHTMLTags( string source)  {         return Regex .Replace(source, "<.*?>", string .Empty);  } And Then use like this ---------------------------- // Data Stored in DataTable if (dt.Rows.Count > 0) { string strterm = Convert .ToString(dt.Rows[0]["term"].ToString()); strterm = RemoveHTMLTags(strterm); } else { }

Page authentication on web pages

Page authentication in web pages Web.config : < system.web >      < compilation debug = " true " targetFramework = " 4.0 " />              < authentication mode = " Forms " >      < forms loginUrl = " Default.aspx " name = " login " timeout = " 120 " ></ forms >      </ authentication >          < authorization >           < deny users = " ? " />      </ authorization >         </ system.web > Login.aspx : protected void btnLogin_Click( object sender, EventArgs e)     {         SqlConnection con = new SqlConnection ( ConfigurationManager .ConnectionStrings[ "dbconnection" ...

Tree view in winforms using c#

Image
Tree view in c# ms sqlserver 2008(database) __________________________ step 1 _________ CREATE TABLE [dbo].[myTable]( [ID] [int] IDENTITY(1,1) NOT NULL, [title] [varchar](255) NOT NULL, [parentID] [int] NULL,  CONSTRAINT [PK_myTable] PRIMARY KEY CLUSTERED  ( [ID] ASC )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY] ) ON [PRIMARY] step 2 _________ INSERT INTO myTable(title, parentID) VALUES('Microsoft', NULL) INSERT INTO myTable( title, parentID) VALUES('C#', 1) INSERT INTO myTable( title, parentID) VALUES('VB.net', 1) INSERT INTO myTable( title, parentID) VALUES('Open Source', NULL) INSERT INTO myTable( title, parentID) VALUES('Python', 4) INSERT INTO myTable( title, parentID) VALUES('Ruby', 4) INSERT INTO myTable( title, parentID) VALUES('PHP', 4) INSERT INTO myTable( title, parentID) VALUES('Perl...