简体   繁体   English

从C#中的代码调用JQuery函数

[英]call a JQuery function from code behind in C#

I want to call this JQuery function from C# code behind but it is not work Here is the JQuery function 我想从C#代码后面调用这个JQuery函数,但它不起作用这里是JQuery函数

function showDialog(id, title) {
$(id).dialog({
    modal: true, minWidth: 600, title: title
});
$(id).parent().appendTo($("form:first"));

} }

and here is the code behind which i use 这是我使用的代码

ClientScript.RegisterClientScriptBlock(this.GetType(), "myfunction", "$(document).ready(function(){showDialog('#editCustomer','نحديث معلومات عميل');});", true);

But it is not work 但这不起作用

ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myfunction", "<script type='text/javascript'>myFunction(params...);</script>", true);

try this, 尝试这个,

ScriptManager.RegisterClientScriptBlock(this.Page,this.GetType(), "myfunction", "$(document).ready(function(){showDialog('#editCustomer','نحديث معلومات عميل');});", true);

also try first putting your jQuery function inside $(). 还尝试首先将你的jQuery函数放在$()中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM