我有一个更新面板在我的网页,其中运行的功能,并发送电子邮件罚款,但是当我加入它下面的code似乎不正确地添加到页面
Page.ClientScript.RegisterClientScriptInclude(的MyScript,/scripts/myscript.js)
在我的子其他的东西
运行正常,但它只是似乎没有运行位?
任何想法?
修改
下面是我的code
< ASP:UpdatePanel的ID =UpdatePanel1=服务器>
<触发器>
< ASP:AsyncPostBackTrigger控件ID =Button1的事件名称=点击/>
< /触发器>
<的ContentTemplate>
< ASP:文本框ID =TextBox1的=服务器
文本=名称/>
< ASP:LinkButton的ID =Button1的的OnClick =submitbutton1=服务器
文本=提交/>
< /的ContentTemplate>
< / ASP:UpdatePanel的>
而小组
子submitbutton1(BYVAL发件人为对象,BYVAL E上EventArgs的)
回复于(测试)
Page.ClientScript.RegisterClientScriptInclude(MyScript可,/scripts/myscript.js)
结束小组
解决方案
使用ScriptManager.RegisterClientScriptInclude。有一个陷阱,但。对于要包括异步每个脚本,你必须结束它
如果(!typeof运算(系统)==未定义)Sys.Application.notifyScriptLoaded();
I have an update panel in my page which runs a function and sends an e-mail fine but when I added in the code below it doesn't seem to add it correctly to the page
Page.ClientScript.RegisterClientScriptInclude("myscript", "/scripts/myscript.js")
All the other stuff in my Sub
runs fine but it just seems to not run that bit?
Any ideas?
EDIT
Here's my code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:TextBox ID="textbox1" runat="server"
Text="Name" />
<asp:LinkButton ID="button1" OnClick="submitbutton1" runat="server"
Text="SUBMIT" />
</ContentTemplate>
</asp:UpdatePanel>
And the Sub
Sub submitbutton1(ByVal sender As Object, ByVal e As EventArgs)
Response.write("Test")
Page.ClientScript.RegisterClientScriptInclude("myscript", "/scripts/myscript.js")
End Sub
解决方案
Use ScriptManager.RegisterClientScriptInclude. There is a catch, though. For each script that you want to include asynchronously, you must end it with
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();