Friday, November 7, 2008

How to Create a New User in Windows Xp without Accessing Another login But Through Command prompt

This is very useful to create admin without entering into windows Screen.

Normally we crearte new user from start->control panel->user account

Ths method is quit interesting to create your own account with out entering into windows screen.

Step to create user Account:

1. when system get boot press F8 function key to get a windows choice menu
2. From that select "COMMAND PROMPT OPTION"
3. After getting Command Prompt use "NET USER" Command to Create account.

EX:

if u need any help about NET USER. u Can Use NET USER ?
NET USER username /add password

if u want delete existing account or any other account
NET USER Accoutname /delete

Wednesday, October 22, 2008

Coding for Sending mail from gmail address using c#.net

Using System.Web.Mail;

MailMessage Mail = new MailMessage();
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.gmail.com");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "vijayfreak@gmail.com");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "Type ur passwor here");
Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");
try
{
Mail.To = "vijayfreak@yahoo.co.in";
Mail.From = "vijay@test.com";
Mail.Subject = "Test message";
Mail.Body = "Test message";
Mail.Cc = "vijayfreak@gmail.com,vijay_mckvm@yahoo.co.in";
MailAttachment m = new MailAttachment("C:\\Documents and Settings\\A\\Desktop\\images.jpg");
Mail.Attachments.Add(m);
SmtpMail.SmtpServer = "smtp.gmail.com:456";
SmtpMail.Send(Mail);
}
catch (Exception ex)
{
Response.Write(ex.ToString() );
}

Wednesday, October 8, 2008

Coding for Google Map Using JavaScript

use this coding with script tag

"http://maps.google.com/maps?file=api&v=2&key=abcdefg"
type="text/javascript"

Here Closing script tag

open another script tag

"function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(22.853145, 80.507813),5);
}
}"
closing script tag

Thursday, September 25, 2008

Coding for changing form background color using CSS

public void Menu_Color_Selection_Method()
{
string color_name = DropDownList1.SelectedValue.ToString();
string path = "CSS\\";
string filename = color_name.ToString();
string extension = ".css";
stylesheet.Href = path + filename + extension;
Image1.ImageUrl = "images\\" + color_name + "_image.jpg";
}

Monday, September 22, 2008

Coding for Accessing Database File USing Code file with DataTable

Note:Place below code in App Folder



using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
///
/// Summary description for Class1
///

public class Class1
{
SqlConnection myconn;
string name,name_copy,ss;
string myConnstr;

public void sql_connection()
{

}
public Class1()
{

}

public DataTable execQuery(string myVarSQL)
{
// added SqlCommand Object 2004-02-02 to control command timeout;
SqlConnection myConn = new SqlConnection("Data Source=.;Initial Catalog=ctsi_web;Integrated Security=True");
myConn.Open();
SqlCommand myCmd = new SqlCommand(myVarSQL, myConn);
//myCmd.CommandTimeout = myCmdTimeout;
myCmd.CommandType = CommandType.Text;
SqlDataAdapter myDA = new SqlDataAdapter(myCmd);


DataTable myDT = new DataTable();
myDA.Fill(myDT);
myConn.Close();
return myDT;
}

}

Code For Filename.aspx.cs file



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Default2 : System.Web.UI.Page
{
Class1 global_declaration = new Class1();
DataTable dt = new DataTable();//creating new Table
protected void Page_Load(object sender, EventArgs e)
{
dt = global_declaration.execQuery("exec sample");//"sample" is a store procedure
foreach(DataRow dr in dt.Rows)//copying all data in datatable and acess from that datatable for Time Consuming
{
string name = dr["Menu_Index"].ToString();
Response.Write("THE VALUES ARE :" + name.ToString());
}

}
}

Coding For Creating Main menu and Sub menus at run time

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class samples : System.Web.UI.Page
{
#region variables_used
static int i;
static string names;
string main_menu_name;
int j;
string[] arr_name = new string[4];
string value;
string index_value;
#endregion

#region SQL_CONNECTION_STRING
SqlConnection con_header = new SqlConnection("Data Source=.;Initial Catalog=ctsi_web;Integrated Security=True");
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=ctsi_web;Integrated Security=True");
#endregion

#region Methods_Used

public void sub_menu()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from master_submenus where Menu_Index='" + names.ToString() + "'", con);
SqlDataReader dr = cmd.ExecuteReader();

while (dr.Read())
{


TableRow tr = new TableRow();
tr.BackColor = System.Drawing.Color.Tomato;


TableCell tc = new TableCell();
tc.ForeColor = System.Drawing.Color.White;
tc.BackColor = System.Drawing.Color.Tomato;
string sub_menu = dr["Sub_Menu_Names"].ToString();
string url = dr["URL"].ToString();
tc.Text = "" + sub_menu.ToString() + "";

string name = dr["Sub_Menu_Names"].ToString();
tr.Cells.Add(tc);

Table2.Rows.Add(tr);

Response.Write("
");



}
//table design style
TableItemStyle tableStyle = new TableItemStyle();
tableStyle.HorizontalAlign = HorizontalAlign.Left;
tableStyle.VerticalAlign = VerticalAlign.Middle;
tableStyle.Width = Unit.Pixel(700);

//aplying design style for table1
foreach (TableRow r in Table1.Rows)
foreach (TableCell c in r.Cells)
c.ApplyStyle(tableStyle);

con.Close();
}
#endregion


protected void Page_Load(object sender, EventArgs e)
{

con_header.Open();//for main menu connection
SqlCommand cmd_header = new SqlCommand("select * from master_mainmenu", con_header);
SqlDataReader dr_header = cmd_header.ExecuteReader();

while (dr_header.Read())
{
//place main menu items in table 1

TableRow tr_header = new TableRow();
TableCell tc_header = new TableCell();

tc_header.BackColor = System.Drawing.Color.Chocolate;
main_menu_name = dr_header["Menu_Names"].ToString();
index_value = dr_header["Menu_Index"].ToString();

//create link for main menu items
tc_header.Text = "" + main_menu_name.ToString() + "";
tr_header.Cells.Add(tc_header);
Table1.Rows.Add(tr_header);
i = i + 1;
names = subOpt.Value.ToString();
}

//calling sub_menu creation Function
sub_menu();

//table design style
TableItemStyle tableStyle = new TableItemStyle();
tableStyle.HorizontalAlign = HorizontalAlign.Center;
tableStyle.VerticalAlign = VerticalAlign.Middle;
tableStyle.Width = Unit.Pixel(200);

//aplying design style for table1
foreach (TableRow r in Table1.Rows)
foreach (TableCell c in r.Cells)
c.ApplyStyle(tableStyle);

//aplying design style for table2
foreach (TableRow rr in Table2.Rows)
foreach (TableCell cc in rr.Cells)
cc.ApplyStyle(tableStyle);
}
}

Tuesday, September 16, 2008

coding for downloading file using c#.net

Using System.Net;

// for Downloading file from net
WebClient c = new WebClient();//for accessing net client
string s = c.DownloadString("http://www.w3schools.com");//read all string from given URL
Response.Write(s.ToString()); //view the page

// path name to download file //paht name to save a file
c.DownloadFile("http://w3schools.com/html/default.asp", "C:\\Documents and Settings\\Administrator\\My Documents\\vijay_programs\\w3schools_index.asp");

coding for Encoding and Decoding

//encode
string data = "a";
byte[] encData_byte = new byte[data.Length];
encData_byte = System.Text.Encoding.UTF8.GetBytes(data);
string encodedData = Convert.ToBase64String(encData_byte);
Response.Write(encodedData.ToString());

//decode

System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();

byte[] todecode_byte = Convert.FromBase64String(encodedData.ToString());
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
string result = new String(decoded_char);
Response.Write(result.ToString());

Wednesday, August 27, 2008

Slide Show Using Javascript

"// The list of images to display in the slideshow"
//creating a array of the image object
"var image=new Array("images/image1.jpg",
"images/image2.jpg",
"images/image3.jpg",
"images/image4.jpg",
"images/image5.jpg",
"images/image6.jpg",
"images/image7.jpg",
"images/image8.jpg",
"images/image9.jpg",
"images/image10.jpg"

" )"

//variable that will increment through the images
"var num=0"

// set the delay between images
var timeDelay

//preload the images in the cache so that the images load faster
//create new instance of images in memory

var imagePreload=new Array()
"for (i=0;i{
imagePreload[i]=new Image()
// set the src attribute
imagePreload[i].src=image[i]
}






//for automatic Slideshow of the Images
function slideshow_automatic()
{

if (num {
num++
//if last image is reached,display the first image
if (num==image.length)
num=0

//sets the timer value to 4 seconds,we can create a timing loop by using the setTimeout method
timeDelay=setTimeout("slideshow_automatic()",4000)
document.images.slideShow.src=image[num]
}


}"

Monday, August 18, 2008

Coding For Printing Page using java script













Coding:


"with in a href tage use coding giving below"

"javascript:window.print()"

below print s used as lable for link....
PRINT
finall close "a href"