------------------------------
int Counter = 60;
int i;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["Counter"] = Counter;
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
i = (int)ViewState["Counter"];
if (i == 0)
{
i = Convert.ToInt32(TextBox1.Text);
ViewState["Counter"] = i;
fileread();
}
else
{
i--;
ViewState["Counter"] = i;
}
Label6.Text = "Time left to refresh : " + ViewState["Counter"].ToString();
}
Monday, August 29, 2011
Wednesday, August 24, 2011
Link for Sample files in .NET
---------------------------
https://skydrive.live.com/?cid=2c5f5b0560e374cb&id=2C5F5B0560E374CB!130
https://skydrive.live.com/?cid=2c5f5b0560e374cb&id=2C5F5B0560E374CB!130
Tuesday, August 23, 2011
Process Kill using .NET
------------------------------------
foreach (Process clsProcess in Process.GetProcesses())
{
string concheck = clsProcess.ToString();
clsProcess.Kill();
}
foreach (Process clsProcess in Process.GetProcesses())
{
string concheck = clsProcess.ToString();
clsProcess.Kill();
}
Execute command prompt in .NET
-----------------------------------
using System.Diagnostics;
System.Diagnostics.Process si = new System.Diagnostics.Process();
si.StartInfo.UseShellExecute = false;
si.StartInfo.FileName = "cmd.exe";
si.StartInfo.CreateNoWindow = true;
si.StartInfo.RedirectStandardInput = true;
si.StartInfo.RedirectStandardOutput = true;
si.StartInfo.RedirectStandardError = true;
cmd = new MySqlCommand("select * from table", con);
dr=cmd.ExecuteReader();
while (dr.Read())
{
path = dr["Fileloc"].ToString();
string[] words = path.Split(new Char[] { '\\' });
drive = words[0];
filename = words[1];
si.StartInfo.WorkingDirectory = drive + "\\";
si.StartInfo.Arguments = "/c " + filename;
si.Start();
string output = si.StandardOutput.ReadToEnd();
error_lbl.Text += si.StandardError.ReadToEnd()+"\n";
si.Close();
}
dr.Close();
using System.Diagnostics;
System.Diagnostics.Process si = new System.Diagnostics.Process();
si.StartInfo.UseShellExecute = false;
si.StartInfo.FileName = "cmd.exe";
si.StartInfo.CreateNoWindow = true;
si.StartInfo.RedirectStandardInput = true;
si.StartInfo.RedirectStandardOutput = true;
si.StartInfo.RedirectStandardError = true;
cmd = new MySqlCommand("select * from table", con);
dr=cmd.ExecuteReader();
while (dr.Read())
{
path = dr["Fileloc"].ToString();
string[] words = path.Split(new Char[] { '\\' });
drive = words[0];
filename = words[1];
si.StartInfo.WorkingDirectory = drive + "\\";
si.StartInfo.Arguments = "/c " + filename;
si.Start();
string output = si.StandardOutput.ReadToEnd();
error_lbl.Text += si.StandardError.ReadToEnd()+"\n";
si.Close();
}
dr.Close();
Wednesday, August 3, 2011
Chart using ASP.NET
---------------------
using System.Web.UI.DataVisualization.Charting;
ArrayList yVal_Overall = new ArrayList();
ArrayList xVal_Overall = new ArrayList();
overallcmd = new SqlCommand("Select * from Customer", con);
overallrdr = overallcmd.ExecuteReader();
while (overallrdr.Read())
{
agentname = overallrdr["Col1"].ToString();
overallcount = Convert.ToInt32(overallrdr["Col2"]);
xVal_Overall.Add(agentname);
yVal_Overall.Add(overallcount);
}
overallrdr.Close();
Chart1.Series[0]["PieLabelStyle"] = "Inside";
Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
Chart1.Titles.Add("Points of Failure");
Chart1.Series[0].Points.DataBindXY(xVal_Overall, yVal_Overall);
//if (overallcount > 2)
//{
// Chart1.Series[0].Points[0]["Exploded"] = "true";
// Chart1.Series[0].Points[1]["Exploded"] = "true";
// Chart1.Series[0].Points[2]["Exploded"] = "true";
using System.Web.UI.DataVisualization.Charting;
ArrayList yVal_Overall = new ArrayList();
ArrayList xVal_Overall = new ArrayList();
overallcmd = new SqlCommand("Select * from Customer", con);
overallrdr = overallcmd.ExecuteReader();
while (overallrdr.Read())
{
agentname = overallrdr["Col1"].ToString();
overallcount = Convert.ToInt32(overallrdr["Col2"]);
xVal_Overall.Add(agentname);
yVal_Overall.Add(overallcount);
}
overallrdr.Close();
Chart1.Series[0]["PieLabelStyle"] = "Inside";
Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
Chart1.Titles.Add("Points of Failure");
Chart1.Series[0].Points.DataBindXY(xVal_Overall, yVal_Overall);
//if (overallcount > 2)
//{
// Chart1.Series[0].Points[0]["Exploded"] = "true";
// Chart1.Series[0].Points[1]["Exploded"] = "true";
// Chart1.Series[0].Points[2]["Exploded"] = "true";
Run exe using asp.net
-------------------
using System.Diagnostics;
string batchpath = @"C:\run.bat";
System.Diagnostics.Process.Start(batchpath);
//System.Diagnostics.Process si = new System.Diagnostics.Process();
//si.StartInfo.WorkingDirectory = "c:\\";
//si.StartInfo.UseShellExecute = false;
//si.StartInfo.FileName = "cmd.exe";
//si.StartInfo.Arguments = "/c notepad.exe";
//si.StartInfo.CreateNoWindow = true;
//si.StartInfo.RedirectStandardInput = true;
//si.StartInfo.RedirectStandardOutput = true;
//si.StartInfo.RedirectStandardError = true;
//si.Start();
//string output = si.StandardOutput.ReadToEnd();
//si.Close();
//Response.Write(output);
using System.Diagnostics;
string batchpath = @"C:\run.bat";
System.Diagnostics.Process.Start(batchpath);
//System.Diagnostics.Process si = new System.Diagnostics.Process();
//si.StartInfo.WorkingDirectory = "c:\\";
//si.StartInfo.UseShellExecute = false;
//si.StartInfo.FileName = "cmd.exe";
//si.StartInfo.Arguments = "/c notepad.exe";
//si.StartInfo.CreateNoWindow = true;
//si.StartInfo.RedirectStandardInput = true;
//si.StartInfo.RedirectStandardOutput = true;
//si.StartInfo.RedirectStandardError = true;
//si.Start();
//string output = si.StandardOutput.ReadToEnd();
//si.Close();
//Response.Write(output);
Facebook API with ASP.NET
Links
------
http://www.kennetham.com/2010/07/21/facebook-api-asp-net/
http://computerbeacon.net/downloads/
------
http://www.kennetham.com/2010/07/21/facebook-api-asp-net/
http://computerbeacon.net/downloads/
Subscribe to:
Posts (Atom)