更新时间: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 /> ;
< 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