In the run prompt type 'Drivers'
Then open the c:\windows\system32\drivers folder
select 'etc' folder and open the 'host' file.
add the IP and name in the host file
10.168.1.171 serverhost
Then we can easily use the connection string like
conString = "server=serverhost;port=3302;user id=sabiq;password=xxxx;persist security info=True;databjavascript:void(0)ase=readymadewh;charset=utf8";
Thursday, March 11, 2010
Monday, March 8, 2010
How to work switch case in c#.net
switch (combo_company.SelectedIndex)
{
case 0:
{
MessageBox.Show("INDIA");
break;
}
case 1:
{
MessageBox.Show("CHINA");
break;
}
case 2:
{
MessageBox.Show("SAUDI");
break;
}
}
{
case 0:
{
MessageBox.Show("INDIA");
break;
}
case 1:
{
MessageBox.Show("CHINA");
break;
}
case 2:
{
MessageBox.Show("SAUDI");
break;
}
}
Saturday, March 6, 2010
Gridview data save to Excel file using ASP.net
Hi
We can simply save or download gridview data to Excel file from our client or browser using this code...
protected void btn_GridtoExcel_Click(object sender, EventArgs e)
{
if (Gridview_barcode.Rows.Count > 0)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving then
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Gridview_barcode.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
else
{
Response.Write("No data found!!");
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
We can simply save or download gridview data to Excel file from our client or browser using this code...
protected void btn_GridtoExcel_Click(object sender, EventArgs e)
{
if (Gridview_barcode.Rows.Count > 0)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving then
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Gridview_barcode.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
else
{
Response.Write("No data found!!");
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
Subscribe to:
Posts (Atom)