如何调用javascript函数.cs文件 [英] how to call javascript function .cs file

查看:71
本文介绍了如何调用javascript函数.cs文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i had javascript function i have to call that function from .cs file not at onclientclick only at button click event in .cs file

<pre lang="xml">&lt;script type=&quot;text/javascript&quot;&gt;
    function RedirectPage()
    {
        var myForm = document.getElementById( &quot;frmTransaction&quot; );
        if(myForm &amp;&amp; myForm.action  != null )
        {
            myForm.action = &quot;https://secure.ebs.in/pg/ma/sale/pay/&quot;;
        }
    }
    &lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;</pre>

推荐答案

在Google上搜索,您会发现很多完整代码的链接

link1 [ link2 [link3 [ ="_ blank" title ="New Window"> ^ ] ....
Search it on google and you will find a lot of links with the entire code

link1[^], link2[^], link3[^]....


您可以使用以下行来解决您的问题.但请确保您的母版页/内容页中存在ScriptManager.
You can use the following line to solve your problem. But make sure ScriptManager exists in your master/content page.
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "RedirectPage();", true);


有关更多信息,请单击此处


For further information please click here


这篇关于如何调用javascript函数.cs文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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