在ASP.NET的母版页中使用JQuery [英] Using JQuery in ASP.NET's master page

查看:58
本文介绍了在ASP.NET的母版页中使用JQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一个使用母版页的asp.net页.我在此页面中放置了一个JQuery代码,但未执行.但是此JQuery代码可以在未使用母版页面文件的其他页面中正确运行.
Jquery文件的路径为true.我将其放在母版页和使用它的页面中,但未执行.
为什么它不起作用.!!!!!!!!!
请帮助我

Hi all
i have an asp.net page that use a master page. i placed a JQuery code in this page, but it not execute. but this JQuery code correctly run in other pages that not used a mater page file.
the path of Jquery file is true. i placed it in both the master page and the page that used it, but it not execute.
why it not work.!!!!!!!!!
please hep me

推荐答案

大家好
第一对不起,因为我的英语说得不好.
终于我找到了答案.在内容页面和母版页文件4中访问任何元素,我们都必须在jquery中使用id选择器. 4例,要访问内容页面或母版页文件中名为"btn1"的asp.net按钮,我们必须编写下面的jquery代码:
hi all
1st excuse me, because i can''t speak eng well.
finally i found my answer. in both the content page and master page file 4 access to any elements we must use the id selector in jquery. 4 ex, for access an asp.net button named "btn1" in content page or master page file we must write the belllow jquery code:


(''[id


=btn1]'').click(function(){/* do somethings...*/});
当内容页面发布到服务器时,asp.net编译器首先找到其母版文件,然后处理该内容页面,然后将其与母版文件合并.并在内容页面和母版页文件中的每个元素上添加一个前缀字符.然后以HTML格式返回结果. asp.net会这样做,以保持唯一性和合格的元素.
=btn1]'').click(function(){/* do somethings...*/});
when a content page posted to server, asp.net compiler 1st find its master page file, then it mangle the content page and then merge it with the master page file. and added a prefix chars to each elements in content page and master page file.then return the result in HTML format. asp.net do this work to keep the Uniquness and Qualified''s elements.


这篇关于在ASP.NET的母版页中使用JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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