Sunday, June 16, 2013
show or hide div in jquery with example
How to Show or Hide div's using jQuery
Show DIV in jquery
jQuery('div').show(); --- Displays all the div's
jQuery('#thisdiv').show(); ---- Displays a div having the id as thisdiv
jQuery('#thisdiv div').show(); ---- Displays all the div's inside the div having the id thisdiv
Hide DIV in jquery
jQuery('div').hide(); --- Hides all the div's
jQuery('#thisdiv').hide(); ---- Hides a div having the id as thisdiv
jQuery('#thisdiv div').hide(); ---- Hides all the div's inside the div having the id thisdiv
div outside thisdiv
thisdiv
div inside thisdiv
Monday, June 3, 2013
Get or Set Http Cookies in server side of C# on Asp.Net Website
Set and Get Cookies
Get Cookie
Sample Code
HttpCookie myCookie = new HttpCookie("sampleCookie");
SampleCookie= Request.Cookies["sampleCookie"];
// Read the cookie information and display it.
if (SampleCookie!= null){
string value= SampleCookie.Value;
string name= SampleCookie.Name;
Explanation
1.Create an object for the HttpCookie Class
HttpCookie myCookie = new HttpCookie("sampleCookie");
2. Get the Cookie from Request.Cookies Collection
SampleCookie= Request.Cookies["view"];
3.Check whether the cookie object is null
if (SampleCookie!= null)
4. Get the Cookie Value and Cookie Name
string value= SampleCookie.Value;
string name= SampleCookie.Name;
Sample Code
Read More
Get Cookie
Sample Code
HttpCookie myCookie = new HttpCookie("sampleCookie");
SampleCookie= Request.Cookies["sampleCookie"];
// Read the cookie information and display it.
if (SampleCookie!= null){
string value= SampleCookie.Value;
string name= SampleCookie.Name;
Explanation
1.Create an object for the HttpCookie Class
HttpCookie myCookie = new HttpCookie("sampleCookie");
2. Get the Cookie from Request.Cookies Collection
SampleCookie= Request.Cookies["view"];
3.Check whether the cookie object is null
if (SampleCookie!= null)
4. Get the Cookie Value and Cookie Name
string value= SampleCookie.Value;
string name= SampleCookie.Name;
Set Cookie
Sample Code
HttpCookie SampleCookie= new HttpCookie("SampleCookie");
SampleCookie.Value="SampleName";
SampleCookie.Name="SampleValue";
myCookie.Domain="sampleDomain.com"
SampleCookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(SampleCookie);
Saturday, June 1, 2013
static vs instance members in C Sharp
Static Versus Instance Members in C#
- By default, members are per instance
- Each instance gets its own fields
- Methods apply to a specific instance
- Static members are per type
- Static methods can’t access instance data
- No this variable in static methods
Static methods
public class Area { private int side; public Rectangle(int side) { this.side= side; } public void Area() { Console.WriteLine("Area output: " + Area.CalculateArea(this.side)); } public static int CalculateArea(int side) { return side* side; } }
Sample