Friday 15 May, 2009

how to check radio button in javascript

var myradio= document.getElementById('myradio');
if (myradio!=null)
{
myradio.checked=true;
}
}

Thursday 7 May, 2009

IIS 7.0

Installation of IIS 7.0 on Vista
Introduction
This article describes installation of IIS using the Windows Vista Control Panel – Windows Features Wizard. New for Windows Vista the Windows Features Wizard:
· Replaces the Windows XP Windows Components Wizard from Add/Remove Windows Components:
· Allow you to install / uninstall Windows Vista Optional Features
· Provides quick status on state of installed Windows Features
Windows Vista Editions Supported
This walkthrough is for the following editions of Windows Vista:
· Windows Vista Ultimate Edition
· Windows Vista Home Premium Edition
· Windows Vista Business Edition
· Windows Vista Enterprise Edition


Make sure you have installed one of the supported editions of Windows Vista before proceeding.

User Account Control (UAC) Security

Make sure you have administrative privileges on the machine: by default, you do not have them if you are logged on as a user other than the built-in Administrator account, even if this user was added to the local Administrators group on the machine (this is a new security feature in Windows Server® 2008, called LUA, which is beyond the scope of this article). Make sure to either log-on as the built-in Administrator account, or explicitly invoke applications as the built-in Administrator, as needed, using the "runas" cmd-line tool. For example, to launch notepad.exe you could run this command: "runas /user:administrator notepad.exe". You will be prompted for the password of the Administrator account. It's useful to have a cmd-box shell that's already elevated, by running "runas /user:administrator cmd.exe". Every application you run from that cmd-box will be elevated as well, and you will not need to use the "runas" syntax from that cmd-box.
Windows Security Dialog – LUA
If you are logged on to an account other than the built in local administrator account, you may see the security alert dialog.
Click Allow to continue running the setup steps in this walkthrough.
Step 1: Start Control Panel
To open Windows Features dialog:
· Click Start Menu
· Click Control Panel

Step 2: Control Panel

The Windows Control Panel is displayed:
· In the Windows Control Panel double click Programs

Step 3: Select Turn On or Off Windows Features

Control Panel Programs options are displayed:
· Click Turn On or Off Windows Features
· You may receive the Windows Security warning at this point
· Click Allow to continue
· The Turn Windows Features on or off dialog will be displayed
· Double click Internet Information Services
· Additional IIS features are displayed
· Check the check box next to Internet Information Services to select the feature for install

Step 5: IIS 7.0 Default Install Selections

· Note that the IIS 7.0 default install features are shown as selected

Step 6: Explore IIS 7.0 Features Available

· To continue expanding features within the list, double click the feature to see sub-features
· For example Double Click on Web Management Tools to see tools installed by default

Step 7: Select IIS 7.0 Features for Install

To install just the IIS 7.0 default features, click OK at this time. If you are installing IIS 7.0 for evaluation purposes, you may want to select additional features within Internet Information Services for installation.
· Check the check boxes for all IIS features you want to install
· After selecting IIS features, click OK to start installation

Step 8: Install Progress

The progress dialog is displayed:

Step 9: Install Complete

When the installation completes, the Windows Features dialog closes and you are returned to the Control Panel.

Step 10: Check IIS 7.0 install

You can now perform a quick check to verify that IIS 7.0 is installed:
· Start Internet Explorer web browser and enter the address
http://localhost/
· You should see the default IIS 7.0 "Welcome" page.

Summary

In this article, you learned how to install IIS 7.0 on Windows Vista using Add/Remove Windows Features Wizard. Please see other setup articles for installing on Windows Server 2008, or installing IIS 7.0 using command line tools or scripts.

Thursday 30 April, 2009

XMLHttpRequest - Post Method

function getNewHTTPObject()
{
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
xmlhttp = false;
}
}
return xmlhttp;
}
/*this function post successfully*/
function postForm(getposturl)
{
var xmlvalue=null;
var xmlpost = new getNewHTTPObject();
xmlpost.onreadystatechange=Gtpost;
xmlvalue="posttitle="+ posttitle.value +"&txtnewpost="+post1.value;
var tmppost = encodeURI(getposturl);
xmlpost.open('POST', tmppost, false);
xmlpost.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlpost.setRequestHeader("Content-length", xmlvalue.length);
xmlpost.setRequestHeader("Connection", "close");
xmlpost.send(xmlvalue);
return;
}

Crystal Report Printing in ASP.Net

function ShowCreprt()
{
string str_sql=null;
DataSet DsMain = new DataSet();
CrystalDecisions.CrystalReports.Engine.ReportDocument rp;

string reportPath = Server.MapPath("LogReport.rpt"); //Set path of Crystal Report

rp = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); // Object of Report Document

sql = "Select l_name as username,'' as sno, userdetail.user_ip as uip from userdetail Where userdetail.user_id=" + int_loginID + " order by servertime";

//in DsMain i fill records as per above query

rp.FileName = reportPath;
rp.SetDataSource(dsmain.Tables[0]);

crviewer.ReportSource = rp;
//I have crviewer control on my page


}

Crystal Report Printing

This example of printing crystal report in Desktop application

Dim DsPrint As New DataSet

//In DsPrint I have my data for printing in crystal reply. Assume that Record only One.

If (DsPrint.Tables(0).Rows.Count - 1) >= 0 Then
Dim ObjR As New CrystalDecisions.CrystalReports.Engine.ReportDocument

ObjR.FileName = "F:\Myproject\CrystalReceipt.rpt" // this is physical path of crystal report.
ObjR.ParameterFields.Item("Trans_ID").CurrentValues.AddValue(Int_TransID)
ObjR.ParameterFields.Item("Str_M").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(5).ToString)
ObjR.ParameterFields.Item("Str_S").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(0).ToString)
ObjR.ParameterFields.Item("Str_C").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(2).ToString)
ObjR.ParameterFields.Item("Str_Con").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(3).ToString)
ObjR.ParameterFields.Item("Str_Del").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(1).ToString)
ObjR.ParameterFields.Item("Str_Price").CurrentValues.AddValue(DsPrint.Tables(0).Rows(0).Item(4).ToString)
ObjR.ParameterFields.Item("Str_Status").CurrentValues.AddValue("Deducted")
ObjR.PrintOptions.PrinterName = str_ReceiptPrinter
ObjR.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape // You can change as per your need.

ObjR.PrintToPrinter(1, False, 1, 1)
End If

Wednesday 29 April, 2009

XMLHttpRequest - GET Method

GET Method:
//object creation.
function getNewHTTPObject()
{
var xmlhttp;
if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try
{
xmlhttp = new XMLHttpRequest();
}
catch (e)
{
xmlhttp = false;
}
}

return xmlhttp;
}

function GetResponse()
{
var xmlHttp= new getNewHTTPObject();
xmlHttp.onreadystatechange = httpCallBack;
/*here httpCallBack is function, this function continues running till get final response.*/

xmlHttp.open('GET','http://www.google.co.in',true);
xmlHttp.Send(null);

}

function httpCallBack()
{
if (xmlHttp.readyState == 4)
{
var xmlDoc = null;
if (xmlHttp.status==200)
{
if (xmlHttp.responseText)
{
var myresp= xmlHttp.responseText;
//myresp geting response from URL.
}
}
else
{
alert('no response or error');
}
}
}

Tuesday 28 April, 2009

Reading/Writing Excel without Office.

//reading and writing into xls file without install office at local machine
OleDbConnection objconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/DataUser/User" + loginfolder + "/" + excelsheetname + ".xls") + ";Extended Properties=Excel 8.0;");
objconn.Open();

DataTable dtSheetSchema = new DataTable();
OleDbCommand ObjCmd;

string Str_Sql;
dtSheetSchema = objconn.GetSchema("Tables"); // for getting all table list

string Str_SheetName = "[" + workbookname + "]";
ObjCmd = new OleDbCommand();
ObjCmd.Connection = objconn;
//this code using for preparing sheet columns headings
if (k == 0)
{
Str_Sql = "Select " + str_header.ToString().Substring(0, str_header.Length - 1) + " into " + Str_SheetName + " From [Sheet1$]";
ObjCmd.CommandText = Str_Sql;
ObjCmd.ExecuteNonQuery();
}

Str_Sql = "";
//this code using for insert value in sheet columns
Str_Sql = "Insert into " + Str_SheetName + "(" + str_columns.ToString().Substring(0, str_columns.Length - 1) + ") values(" + str_colvalue.ToString().Substring(0, str_colvalue.Length - 1) + ")";
ObjCmd.CommandText = Str_Sql;
ObjCmd.ExecuteNonQuery();
str_colvalue.Remove(0, str_colvalue.Length);
}
objconn.Close();