客户端名称在当前上下文中不存在 [英] the name clientscript does not exist in current context

查看:112
本文介绍了客户端名称在当前上下文中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii的朋友......



i写了一个jquery,用于在asp.net中点击按钮时显示进度条...代码工作正常..从这里调用这个脚本代码背后如下所示。



  string  script =   $(document).ready(function(){$('[id * = btngenerate1]')。click();} );; 
ClientScript.RegisterStartupScript( this .GetType(), 点击,脚本, true );



但它给我的错误信息那个'客户名称在当前上下文中不存在''。我还在母版页的scriptmanager标签中写了所有jscript。



< asp:ScriptManager ID =   ScriptManager1 runat =  服务器 >  
& lt; Scripts>
< asp:ScriptReference Path = 〜/ jquery / jquery-1.2.3.min.js />
< asp:ScriptReference Path = 〜/ jquery / jqModal.js /> ;
< asp:ScriptReference Path = 〜/ jquery / coloranim.js /> ;
< asp:ScriptReference Path = 〜/ jquery / jquery.js /> ;

& lt; / Scripts>
< / asp:ScriptManager >





请帮帮我..

提前谢谢。

解决方案

(document).ready(function(){


('[id * = btngenerate1]')。click();}); ;
ClientScript.RegisterStartupScript( this .GetType(), < span class =code-string>点击,脚本, true );



但它给我的错误信息是''客户名称在当前上下文中不存在''。我还在主页中的scriptmanager标签中写了所有jscript。



< pre lang =c#>< asp:ScriptManager ID = ScriptManager1 runat = s erver >
& lt; Scripts>
< asp:ScriptReference Path = 〜/ jquery / jquery-1.2.3.min.js />
< asp:ScriptReference Path = 〜/ jquery / jqModal.js /> ;
< asp:ScriptReference Path = 〜/ jquery / coloranim.js /> ;
< asp:ScriptReference Path = 〜/ jquery / jquery.js /> ;

& lt; / Scripts>
< / asp:ScriptManager >





请帮帮我..

提前感谢。


尝试 Page.ClientScript.RegisterClientScriptBlock 而不是 ClientScript.RegisterStartupScript



为了更好地理解 RegisterStartupScript RegisterClientScriptBlock 之间的区别,请阅读 [ ^ ]。



祝你好运,

OI


Hii friends...

i have written jquery for showing progressbar when clicking button in asp.net..code is working fine..i m calling this script from code behind as shown below.

string script = "$(document).ready(function () { $('[id*=btngenerate1]').click(); });";
        ClientScript.RegisterStartupScript(this.GetType(), "click", script, true);


but its giving me error message that'' the name clientscript does not exist in current context''. i also written all jscript in scriptmanager tag in master page.

<asp:ScriptManager ID="ScriptManager1" runat="server">
        &lt;Scripts>
            <asp:ScriptReference Path="~/jquery/jquery-1.2.3.min.js" />
            <asp:ScriptReference Path="~/jquery/jqModal.js" />
            <asp:ScriptReference Path="~/jquery/coloranim.js" />
            <asp:ScriptReference Path="~/jquery/jquery.js" />

        &lt;/Scripts>
    </asp:ScriptManager>



please help me..
thanks in advance.

解决方案

(document).ready(function () {


('[id*=btngenerate1]').click(); });"; ClientScript.RegisterStartupScript(this.GetType(), "click", script, true);


but its giving me error message that'' the name clientscript does not exist in current context''. i also written all jscript in scriptmanager tag in master page.

<asp:ScriptManager ID="ScriptManager1" runat="server">
        &lt;Scripts>
            <asp:ScriptReference Path="~/jquery/jquery-1.2.3.min.js" />
            <asp:ScriptReference Path="~/jquery/jqModal.js" />
            <asp:ScriptReference Path="~/jquery/coloranim.js" />
            <asp:ScriptReference Path="~/jquery/jquery.js" />

        &lt;/Scripts>
    </asp:ScriptManager>



please help me..
thanks in advance.


Try Page.ClientScript.RegisterClientScriptBlock instead of ClientScript.RegisterStartupScript

For better understanding the difference between RegisterStartupScript and RegisterClientScriptBlock please read here[^].

Good luck,
OI


这篇关于客户端名称在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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