asp.net aspx页面中的webuser控件 [英] webuser controle in asp.net aspx page

查看:66
本文介绍了asp.net aspx页面中的webuser控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在该页面使用webuser控件我为文本框编写了一个javascript函数,然后如何在另一个aspx页面中调用该javascript函数。



like for例如:



该页面中的SampleWebusercontrole.ascx

------------------ -------------------------------------------------- -------

i am using webuser controle in that page i wrote one javascript funtion for text box ,then how to call that javascript function in another aspx page .

like for example:

SampleWebusercontrole.ascx in that page
---------------------------------------------------------------------------

<script type="text/javascript">
 function QuantityChange()
 {
   //our Code
 }
</script>







< asp:textbox id = txtquantityrunat =serveronchange =QuantityChange()/>

----------- -------------------------------------------------- --------------------



sample.aspx

--- -------------------------------------------------- --------------------------



在这个页面我想用javascript功能



如何在sample.aspx中调用那个javascript函数而不是在sample.aspx.cs中

请帮帮我...... br $> b $ b

----------------------------------- ----------------------------------------




<asp:textbox id="txtquantity" runat="server" onchange="QuantityChange()"/>
---------------------------------------------------------------------------------

sample.aspx
-------------------------------------------------------------------------------

in this page i want use that javascript function

how to call that javascript function in sample.aspx not in sample.aspx.cs
pls help me....

---------------------------------------------------------------------------

推荐答案

You should place all your global functions,variable etc in a .js file and then on all pages that need to call any of these routines you should declare it like this




<script src="myglobals.js" type="text/javascript"></script>







Now you can access your global functions and variables.Happy Coding


尝试使用...

Try using...
parent.QuantityChange()



如果从其他页面访问任何.js函数,请使用parent访问该函数。



希望这会有所帮助。


If you access any .js function from other page use "parent" to access that function.

Hope this will help.


这篇关于asp.net aspx页面中的webuser控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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