Set variables on a master page from content pages C#

studentID = System.Convert.ToInt32(Session[“sid”]);
studentFname = Session[“studentFname”].ToString();
studentMname = Session[“studentMname”].ToString();
studentLname = Session[“studentLname”].ToString();
char[] m = studentMname.ToCharArray();
studentMiddleInitial = m[0].ToString();

Label1.Text = studentID.ToString();
Label mpLogin = (Label)Master.FindControl(“usernamedisplay1″);
mpLogin.Text = studentFname + ” ” + studentMiddleInitial + ” ” + studentLname;

Make first letter of a string upper case in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FirstLetterUpperCaseString
{
    class FirstLetterUpperCase
    {
        static void Main(string[] args)
        {
            string a = "akshay upadhyay";
            Console.WriteLine("Before operation : " + a);

            //Converting string to character array
            char[] s = a.ToCharArray();

            //Convert the first char to upper case
            s[0] = char.ToUpper(s[0]);

            //Reconverting array to string
            a = new string(s);
            Console.WriteLine("After operation : " + a);

            Console.Read();
        }
    }
}

Get ID of last record inserted – VBScript – SQL Server

Here is the technique to get the ID number of the last record inserted (right as you insert it)

Dim db,rcs,new_identity

‘Create a database connection
Set db = Server.CreateObject(“adodb.connection”)
db.Open “DSN=MyDSN”

‘Execute the INSERT statement and the SELECT @@IDENTITY
Set rcs = db.execute(“insert into tablename (fields,..) ” & _
“values (values,…);” & _
“select @@identity”).nextrecordset

‘Retrieve the @@IDENTITY value
new_identity = rcs(0)

CSS3 Glowing Inputs

input[type=text], textarea {
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid #ddd;
}

input[type=text]:focus, textarea:focus {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid rgba(81, 203, 238, 1);
}

 

 

CSS3 Full Screen Backgrounds

html {
background: url(‘images/bg.jpg’) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

I should note that this code will not work properly in older browsers which do not support CSS3 syntax. However if you’re looking for a quick solution and don’t care about legacy support, this is the best chunk of code you’ll find! Great for adding big photographs into the background of your website while keeping them resizable and fixed as you scroll

 

CSS – Polaroid Image Border

img.polaroid {
    background:#000; /*Change this to a background image or remove*/
    border:solid #fff;
    border-width:6px 6px 20px 6px;
    box-shadow:1px 1px 5px #333; /* Standard blur at 5px. Increase for more depth */
    -webkit-box-shadow:1px 1px 5px #333;
    -moz-box-shadow:1px 1px 5px #333;
    height:200px; /*Set to height of your image or desired div*/
    width:200px; /*Set to width of your image or desired div*/
}
This will create the old photo-style effect with a large white border and some slight box shadows.

Modern CSS Font Stacks

/* Times New Roman-based serif */
font-family: Cambria, “Hoefler Text”, Utopia, “Liberation Serif”, “Nimbus Roman No9 L Regular”, Times, “Times New Roman”, serif;

/* A modern Georgia-based serif */
font-family: Constantia, “Lucida Bright”, Lucidabright, “Lucida Serif”, Lucida, “DejaVu Serif,” “Bitstream Vera Serif”, “Liberation Serif”, Georgia, serif;

/*A more traditional Garamond-based serif */
font-family: “Palatino Linotype”, Palatino, Palladio, “URW Palladio L”, “Book Antiqua”, Baskerville, “Bookman Old Style”, “Bitstream Charter”, “Nimbus Roman No9 L”, Garamond, “Apple Garamond”, “ITC Garamond Narrow”, “New Century Schoolbook”, “Century Schoolbook”, “Century Schoolbook L”, Georgia, serif;

/*The Helvetica/Arial-based sans serif */
font-family: Frutiger, “Frutiger Linotype”, Univers, Calibri, “Gill Sans”, “Gill Sans MT”, “Myriad Pro”, Myriad, “DejaVu Sans Condensed”, “Liberation Sans”, “Nimbus Sans L”, Tahoma, Geneva, “Helvetica Neue”, Helvetica, Arial, sans-serif;

/*The Verdana-based sans serif */
font-family: Corbel, “Lucida Grande”, “Lucida Sans Unicode”, “Lucida Sans”, “DejaVu Sans”, “Bitstream Vera Sans”, “Liberation Sans”, Verdana, “Verdana Ref”, sans-serif;

/*The Trebuchet-based sans serif */
font-family: “Segoe UI”, Candara, “Bitstream Vera Sans”, “DejaVu Sans”, “Bitstream Vera Sans”, “Trebuchet MS”, Verdana, “Verdana Ref”, sans-serif;

/*The heavier “Impact” sans serif */
font-family: Impact, Haettenschweiler, “Franklin Gothic Bold”, Charcoal, “Helvetica Inserat”, “Bitstream Vera Sans Bold”, “Arial Black”, sans-serif;

/*The monospace */
font-family: Consolas, “Andale Mono WT”, “Andale Mono”, “Lucida Console”, “Lucida Sans Typewriter”, “DejaVu Sans Mono”, “Bitstream Vera Sans Mono”, “Liberation Mono”, “Nimbus Mono L”, Monaco, “Courier New”, Courier, monospace;

Check out here for some great font references.

http://www.cssfontstack.com/

 

General Media Queries

/* Smartphones (portrait and landscape) ———– */
@media only screen
and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ———– */
@media only screen and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ———– */
@media only screen and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ———– */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ———– */
@media only screen and (min-width : 1224px) {
/* Styles */
}

/* Large screens ———– */
@media only screen and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ———– */
@media only screen and (-webkit-min-device-pixel-ratio:1.5), only screen and (min-device-pixel-ratio:1.5) {
/* Styles */
}