function ConfirmActive()
{
if(<%= TimeSheetFlag %> != -100) //do not save or cancel about the previous item
{
if (confirm("Are you sure you want to delete the custom search?") == false)
{
SetCancel();//请注意这儿
}
}
return true;
}
function SetCancel()
{
alert("sdd");//这儿
var cancel = document.getElementById("cmdSetCancel"); //服务器端控件
cancel.click(); //调用点击事件.
alert("add");////这儿
}
问题是这样的:如果我把alert(sdd)...add加上,服务器端事件就可以正常触发,如果去掉就不触发了.真是奇怪!
请帮忙.
{
if(<%= TimeSheetFlag %> != -100) //do not save or cancel about the previous item
{
if (confirm("Are you sure you want to delete the custom search?") == false)
{
SetCancel();//请注意这儿
}
}
return true;
}
function SetCancel()
{
alert("sdd");//这儿
var cancel = document.getElementById("cmdSetCancel"); //服务器端控件
cancel.click(); //调用点击事件.
alert("add");////这儿
}
问题是这样的:如果我把alert(sdd)...add加上,服务器端事件就可以正常触发,如果去掉就不触发了.真是奇怪!
请帮忙.
解决方案 »
- 如何将一个类文件封装成dll
- 关于页面登陆按扭的问题
- gridview的问题求教
- 引用app.config中的数据库连接
- 如何让repeater的一行显示3列,而不是一行就一列!在线等,急!
- 如何启动客户端的一个程序(Asp.net+c#),例如启动Window2000的附件中的图像处理文件kodakimg.exe?
- 上传组件写的时候的问题~可以传图不能传附件?奇怪
- 如何判断从数据库中取出来的的数是否为空?
- 急急!!我是想要一个判断!大于A小于Z的表达式!!要能在cs页面里面能认识的!ASC在那里不认识!老报错!!
- 两个datagrid的问题?
- 请问怎样手动和自动刷新页面?
- 上传信息统计,不知道怎么在datagrid里面循环显示统计数字,苦等高手相助!!55~~~~~~~~~~~~~~
.cs
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
ImageButton1.Attributes.Add("onclick","return CC();");
} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
int xx = 1;
} private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
int yy = 2;
}.aspx<script language = "javascript">
function CC()
{
//alert("sdd");
document.all.Button1.click();
//alert("add");
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:ImageButton id="ImageButton1" style="Z-INDEX: 101; LEFT: 384px; POSITION: absolute; TOP: 224px"
runat="server"></asp:ImageButton>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 544px; POSITION: absolute; TOP: 344px" runat="server"
Text="Button"></asp:Button>
</form>
string strScript = GetPostBackEventReference(ImageButton1)获得控件引起会送的js语句,再处理
{
document.all.Button1.click();
return false;
}