我试图从代码隐藏中调用js函数,如
<if(result == true)
MyJsFunction();
我怎么能这样做?
我试过
string rowTestHide = @" <script type='text/javascript'>function showSuccessMessage(){
showNotification({
type : 'success',
message: 'This is a sample success notification'
});
}
</script>";
ClientScript.RegisterStartupScript(null,"rowTest", rowTestHide);
但它不起作用
答案 0 :(得分:1)
你不想要这个功能......你只想立即运行它。像这样:
string rowTestHide = @"<script type='text/javascript'>
showNotification({
type : 'success',
message: 'This is a sample success notification'
});
</script>";
ClientScript.RegisterStartupScript(this.GetType(),"rowTest", rowTestHide);