how to call a javascript function from c# code behind

initially a table is invisible in the ASP.NET page. on button click event, it should go to the code behind and from there i need to call a function in javascript. In that javascript function i should make the table to be visible. Is this possible?? Somebody please help me out


尝试这个:

Page.ClientScript.RegisterStartupScript(GetType(), "MyKey", "Myfunction();", true);

try the following code

ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "alert('hello');", true);

Here " this " is used for control by which you want to fire this. this.Gettype() is used get type of Client Script " isActive " it is the unique key. After all these the javascript code. it could be function whatever you want to do. and lastly there is true that ask you either you want to script tag for the javascript code you are writing here or not.


     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "HelloWorld", "HelloWorld();", true);
链接地址: http://www.djcxy.com/p/30994.html

上一篇: 在JavaScript中调用ac#函数

下一篇: 如何从后面的c#代码调用JavaScript函数