English 中文(简体)
在使用点击手器时,“系统不是未界定的”Java 字典错误?
原标题:"System is undefined" JavaScript error when using click handler?

在一栏中,我有一顿的网格。 我在电网概览中加上后面的代码。 我用这条线附上我的点击事件:

cmd1.OnClientClick +=new eventHandler(cmd1_Click);

Now every time I click that button, it gives me a run time error and breaks at System.EventHandler of <input type="submit" name="grvList$ctl02$ctl05" value="Add" onclick="System.EventHandler;" />

任何人都没有遇到这一问题。

最佳回答

由于用户1090190在评论中写道,onclick(产生于OnClientClick/code>) 已在作为 Java本的网络浏览器上执行。

The += in this case is calling ToString() on the new EventHandler object that is created which results in the string "System.EventHandler". (The += expression expands to cmd1.OnClientClick = cmd1.OnClientClick + (new EventHandler(cmd1_Click)); and the implicit conversion happens because OnClientClick is typed as a string.)

可能的话(注no.Client):

cmd1.Click += new EventHandler(cmd1_Click)

或者,更简单地说(don问我,为什么汽车装饰总是“瓦解”):

cmd1.Click += cmd1_Click;

确保酌情设立each后台。

幸福 co。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!