且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

客户端名称在当前上下文中不存在

更新时间:2022-10-25 09:55:14

(document).ready(function(){


('[id * = btngenerate1]')。click();}); ;
ClientScript.RegisterStartupScript( this .GetType(), 点击,脚本, true );



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



< 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 /&gt ;
< asp:ScriptReference Path = 〜/ jquery / coloranim.js /&gt ;
< asp:ScriptReference Path = 〜/ jquery / jquery.js /&gt ;

& 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