This blog provide knowledge of all type of query. I want to share my experience with all.
Friday, 15 May 2009
how to check radio button in javascript
if (myradio!=null)
{
myradio.checked=true;
}
}
Thursday, 7 May 2009
IIS 7.0
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
{
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
{
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
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
//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.
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();
Monday, 27 April 2009
Crystal Report Configuration in IIS
Drive letter depands on you that where installed your .net
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\CRRedist2005_x86.msi
After find out below path in your system.
Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\
If in your server crystal report support installed then you found below path
Under below path if this path is available then you configure this path in your crystal report viewer control
suppose my path is below
Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\
set crystal report viewer property ToolbarImagesFolderUrl="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/images/toolbar/"
Note : If on server Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3 this path is not available then must be create path.
You can copy and paste on server from local machine.. It will be work.
Tuesday, 21 April 2009
Extracting Attributes from XML file
<entry>
<id>myid</id>
<published>mydate</published>
<updated>2009-04-20T22:42:23.233-07:00</updated>
<title type='text'>ASP.NET</title>
<summary type='html'></summary>
<link rel='self' type='application/atom+xml' href='#'/>
<link rel='alternate' type='text/html' href='#'/>
<link rel='http://schemas.my.com/g/2005#feed' type='application/atom+xml' href='#'/>
<link rel='http://schemas.my.com/g/2005#post' type='application/atom+xml' href='#'/>
<link rel='http://schemas.my.com/e' type='application/atom+xml' href='#'/>
<link rel='http://schemas.my.com/g/2008#settings' type='application/atom+xml' href='#'/>
<author>
<name>naresh</name>
<uri>http://www.naresh.com/profile</uri>
<email>noreply@blogger.com</email>
</author>
</entry>
This code read below xml attributes... Working fine.
void ReadXML()
{
XmlDocument xmldoc;
XmlNodeList xmlnodes;
DataSet dsxml = new DataSet();
dsxml = //using this if fill this dataset from database;
dsxml.ReadXml("write here xml path"); // if you have xml file then load xml file in dataset
if (dsxml.Tables.Count > 0)
{
xmldoc = new XmlDocument();
xmldoc.LoadXml(dsxml.GetXml());
xmlnodes = xmldoc.GetElementsByTagName("entry"); // here entry is element
XmlElement xmlel = null;
if (xmlnodes.Count > 0)
{
for (int k = 0; k < xmlnodes.Count; k++)
{
xmlel = xmlnodes[k]["link"];
string str_desc = "";
str_desc = getXmlItem(xmlnodes, "title", "", k);
}
}
}
}
object getXmlItem(XmlNodeList aItem, string aWhat, string aInitValue, int int_aItemIndex)
{
string tmpVar = aInitValue;
if ((aItem[int_aItemIndex][aWhat] != null) && (aItem[int_aItemIndex][aWhat] != null))
{
if ((aItem[int_aItemIndex][aWhat].FirstChild != null) && (aItem[int_aItemIndex][aWhat] != null))
{
tmpVar = aItem[int_aItemIndex][aWhat].FirstChild.Value;
}
}
return tmpVar;
}
Load Report Failed.
CrystalDecisions.CrystalReports.Engine.ReportDocument rp;
string reportPath = Server.MapPath("LogReport.rpt");
rp = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
sql = "Select 'User Name :'+lmaster.l_name as username,'' as sno, userdetail.user_ip as uip from userdetail order by servertime";
dsmain = mydata.GetDataSet(sql, 1);// this method my own method will be return query data in dataset.
rp.FileName = reportPath;
rp.SetDataSource(dsmain.Tables[0]);
crviewer.ReportSource = rp;
Thursday, 16 April 2009
Difference between dataset and array
I remember that once in my project I need to compare single column value from text file. Then i used DataSet, but row is more then 90,00,000 so it is failed there.
So i used normal array. It is working so fine. Normal Array can hold more then 10,000,000 value.
It is very easy to compare with array because we can use binary search.
Change Report Viewer Toolbar Images.
Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\
If in your server crystal report support installed then you found below path
Under below path you get then all images of report viewer control.
Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\images\toolbar
You can replace your images with default images.
Note. Images name are same as default images.
Please Let me know if any query.
Monday, 13 April 2009
Sending Mail
MailMessage objmail = new MailMessage("from mail address", "to mail address", "mail subject", mail message);
SmtpClient Objsmtpclient = new SmtpClient();
Objsmtpclient.Host = "write here your smtp ip (your smtp server ip)";
Objsmtpclient.Send(objmail);
Saturday, 4 April 2009
What is SOA?
The .Net technology introduces the SOA by mean of web services.
The SOA can be used as the concept to connect multiple systems to provide services. It has it's great share in the future of the IT world.
According to the imaginary diagram above, we can see how the Service Oriented Architecture is being used to provide a set of centralized services to the citizens of a country. The citizens are given a unique identifying card, where that card carries all personal information of each citizen. Each service centers such as shopping complex, hospital, station, and factory are equipped with a computer system where that system is connected to a central server, which is responsible of providing service to a city. As an example when a customer enter the shopping complex the regional computer system report it to the central server and obtain information about the customer before providing access to the premises. The system welcomes the customer. The customer finished the shopping and then by the time he leaves the shopping complex, he will be asked to go through a billing process, where the regional computer system will manage the process. The payment will be automatically handled with the input details obtain from the customer identifying card.
The regional system will report to the city (computer system of the city) while the city will report to the country (computer system of the country).
What is Software Architecture?
* Partitioning the problem and the system to be built into discrete pieces
* Techniques used to create interfaces between these pieces
* Techniques used to manage overall structure and flow
* Techniques used to interface the system to its environment
* Appropriate use of development and delivery approaches, techniques and tools.
Download Data From Website
Dim ObjWebClient as new WebClient
ObjWebClient.DownloadFileAsync(uri, SavePath)
While ObjWebClient.IsBusy = True
comehere:
If ObjWebClient.IsBusy = True Then
GoTo comehere
Else
GoTo exitloop
End If
End While
Tuesday, 31 March 2009
Get Response in DataSet
{
WebResponse ObjWebResp;
WebRequest ObjWebReq;
StreamReader ObjReader;
XmlTextReader xmlread;
ObjWebReq = WebRequest.Create(str_BlogUrl);
ObjWebReq.Timeout = 6000;
ObjWebResp = ObjWebReq.GetResponse();
ObjReader = new StreamReader(ObjWebResp.GetResponseStream());
xmlread = new XmlTextReader(ObjReader);
DataSet ds = new DataSet();
ds.ReadXml(xmlread);
ObjReader.Close();
ObjReader.Dispose();
ObjWebResp.Close();
return ds;
}
Monday, 30 March 2009
Convert Image into Base64String
string GetBase64String(string str_imagepathString)
{
string str_image = str_imagepathString;
WebClient wc = new WebClient();
byte[] myimage;
string str_base64 = null;
myimage = wc.DownloadData(str_image);
str_base64 = Convert.ToBase64String(myimage);
return str_base64;
}