include following file
------------------------------------------------------------------
using System.Diagnostics;
using System.IO;
-------------------------------------------------------------------
On Button Click
------------------------------------------------------------------
ProcessStartInfo myStartInfo = new ProcessStartInfo();
myStartInfo.WorkingDirectory = @"c:\";
myStartInfo.FileName = @"c:\WINDOWS\system32\xcopy.exe";
myStartInfo.Arguments = @"c:\a.bat d:\temp\"; // give proper soucrce and
//destination path
myStartInfo.UseShellExecute = false;
Process myProcess = Process.Start(myStartInfo);
Wednesday, January 28, 2009
Monday, June 09, 2008
ICallBackHandeler in ASP.NET
Create a Database with following spe
cification:
Code for ICallBackHandeler1.aspx
html xmlns="http://www.w3.org/1999/xhtml" >
head runat="server">
CallBack
/head>
body>
script language="javascript">
function DropDownList1_onChange(sender, eventArgs)
{
var empId =document.getElementById('<%=DropDownList1.ClientID %>').value;
alert(empId);
CallServerSideFunction(empId);
}
function CallbackOnSucceeded(Args)
{
alert(Args);
}
/script>
form id="form1" runat="server">
asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="EMPNO" DataValueField="EMPNO" EnableTheming="false">
Select
/asp:DropDownList>
asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [EMPNO] FROM [EMP]">
/form>
/body>
/html>
Code for ICallBackHandeler1.aspx.CS
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;
public partial class ICallBackHandeler : System.Web.UI.Page, ICallbackEventHandler
{
string IcallBackvalue;
// string empId;
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Attributes.Add("onChange","DropDownList1_onChange();");
RegisterCallBackReference();
SqlDataSource ds = new SqlDataSource();
}
private void RegisterCallBackReference()
{
String callBack = Page.ClientScript.GetCallbackEventReference(this, "args", "CallbackOnSucceeded", "context", true);
String clientFunction = "function CallServerSideFunction(args, context){ " + callBack + "; }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"Call To Server", clientFunction, true);
}
string ICallbackEventHandler.GetCallbackResult()
{
return IcallBackvalue;
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
string temp;
string name ;
temp = eventArgument.ToString();
if (temp == "HYD0000001")
{
name = "Ashwini Kumar";
}
else if (temp == "HYD0000002")
{
name = "DANODER";
}
else if (temp == "HYD0000003")
{
name = "DEV";
}
else if (temp == "HYD0000004")
{
name = "Ranjit Kumar";
}
else
{
name = "";
}
//IcallBackvalue = "Ashwini";
IcallBackvalue = name;
}
}
Code for ICallBackHandeler1.aspx
html xmlns="http://www.w3.org/1999/xhtml" >
head runat="server">
/head>
body>
script language="javascript">
function DropDownList1_onChange(sender, eventArgs)
{
var empId =document.getElementById('<%=DropDownList1.ClientID %>').value;
alert(empId);
CallServerSideFunction(empId);
}
function CallbackOnSucceeded(Args)
{
alert(Args);
}
/script>
form id="form1" runat="server">
asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="EMPNO" DataValueField="EMPNO" EnableTheming="false">
/asp:DropDownList>
asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [EMPNO] FROM [EMP]">
/form>
/body>
/html>
Code for ICallBackHandeler1.aspx.CS
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;
public partial class ICallBackHandeler : System.Web.UI.Page, ICallbackEventHandler
{
string IcallBackvalue;
// string empId;
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Attributes.Add("onChange","DropDownList1_onChange();");
RegisterCallBackReference();
SqlDataSource ds = new SqlDataSource();
}
private void RegisterCallBackReference()
{
String callBack = Page.ClientScript.GetCallbackEventReference(this, "args", "CallbackOnSucceeded", "context", true);
String clientFunction = "function CallServerSideFunction(args, context){ " + callBack + "; }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"Call To Server", clientFunction, true);
}
string ICallbackEventHandler.GetCallbackResult()
{
return IcallBackvalue;
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
string temp;
string name ;
temp = eventArgument.ToString();
if (temp == "HYD0000001")
{
name = "Ashwini Kumar";
}
else if (temp == "HYD0000002")
{
name = "DANODER";
}
else if (temp == "HYD0000003")
{
name = "DEV";
}
else if (temp == "HYD0000004")
{
name = "Ranjit Kumar";
}
else
{
name = "";
}
//IcallBackvalue = "Ashwini";
IcallBackvalue = name;
}
}
Wednesday, February 07, 2007
What a Illusion
Note: Please first Click on the Image.If your eyes follow the movement of the rotating pink dot, you will only see one color, pink.
If you stare at the black + in the center, the moving dot turns to green.
Now, concentrate on the black + in the center of the picture. After a short period of time, all the pink dots will slowly disappear, and you will only see a green dot rotating.
It's amazing how our brain works. In reality there were no green dot, and the pink ones really don't disappear.
If you stare at the black + in the center, the moving dot turns to green.
Now, concentrate on the black + in the center of the picture. After a short period of time, all the pink dots will slowly disappear, and you will only see a green dot rotating.
It's amazing how our brain works. In reality there were no green dot, and the pink ones really don't disappear.
Subscribe to:
Posts (Atom)
