客户端名称在当前上下文中不存在 [英] the name clientscript does not exist in current context
问题描述
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">
<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" />
</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"> <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" /> </Scripts> </asp:ScriptManager>
please help me..
thanks in advance.
TryPage.ClientScript.RegisterClientScriptBlock
instead ofClientScript.RegisterStartupScript
For better understanding the difference betweenRegisterStartupScript
andRegisterClientScriptBlock
please read here[^].
Good luck,
OI
这篇关于客户端名称在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!