从C#按钮调用jQuery [英] Invoking jQuery from a C# Button

查看:118
本文介绍了从C#按钮调用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我按下位于C#侧的编辑"按钮时,我基本上想运行网格jquery UI代码.我发现我无法使用这些示例来使我的版本正常工作.

因此,如果有人能解释它的完成方式和工作方式,我将不胜感激,因为生病的人还需要通过单击另一个按钮来弄清楚如何停止该功能.

jQuery是在这里找到的示例,如果有帮助
http://jqueryui.com/demos/sortable/#display-grid [

I basically want to run the grid jquery UI code when I hit the edit button which is located on my C# side. The examples Iv''e found I haven''t been able to use to make my version work.

So I''d appreciate if someone would explain how it''s done and how it works since ill need to figure out how to stop the function too by another button click.

the Jquery is the example found here If it helps
http://jqueryui.com/demos/sortable/#display-grid[^]

This code would be on the html side, I need to modify it so that it doesn''t run on page load and only runs when Button1 is clicked.

<script>
    $(function() {
        $( "#sortable" ).sortable();
        $( "#sortable" ).disableSelection();
    });
</script>


protected void Button1_Click(object sender, EventArgs e)
{
// this button would be clicked to run the function above activating the sortable grid.
}



固定的!我需要将其添加到外部



Fixed! I needed to add this to the outside

$(document).ready(function() {        
        
    });





毕竟,问题似乎是当我按下按钮时页面回发时,JavaScript像以前从来没有打开过一样被关闭了,一个简单的onclientClick .... return false;





It seems after all of that the problem is that when the page posts back when i hit the button the javascript is turned off like it was never on in the first place a simple onclientClick.... return false; worked in the end.

推荐答案

(function(){
(function() {


("#sortable").sortable();
( "#sortable" ).sortable();


("#sortable").disableSelection(); }); < /script >
( "#sortable" ).disableSelection(); }); </script>


protected void Button1_Click(object sender, EventArgs e)
{
// this button would be clicked to run the function above activating the sortable grid.
}



固定的!我需要将其添加到外部



Fixed! I needed to add this to the outside


这篇关于从C#按钮调用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆