call a JQuery function from code behind in C#

这一生的挚爱 提交于 2019-12-23 02:14:01

问题


I want to call this JQuery function from C# code behind but it is not work Here is the JQuery function

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


回答1:


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



回答2:


try this,

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

also try first putting your jQuery function inside $().



来源:https://stackoverflow.com/questions/19020303/call-a-jquery-function-from-code-behind-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!