Asp.net 如何将UpdatePanel的实际控件id发送到UpdatePanelAnimationExtender脚本操作脚本?
我需要将.NET为UpdatePanel的div生成的实际控件id发送到javascript函数。如何重写下面的脚本操作行以完成此操作Asp.net 如何将UpdatePanel的实际控件id发送到UpdatePanelAnimationExtender脚本操作脚本?,asp.net,updatepanel,ajaxcontroltoolkit,Asp.net,Updatepanel,Ajaxcontroltoolkit,我需要将.NET为UpdatePanel的div生成的实际控件id发送到javascript函数。如何重写下面的脚本操作行以完成此操作 <asp:UpdatePanel ID="update1" runat="server" UpdateMode="Conditional"> ... </asp:UpdatePanel> <cc1:UpdatePanelAnimationExtender runat="server" TargetControlID="up
<asp:UpdatePanel ID="update1" runat="server" UpdateMode="Conditional">
...
</asp:UpdatePanel>
<cc1:UpdatePanelAnimationExtender runat="server" TargetControlID="update1">
<Animations>
<OnUpdating>
<Parallel duration="0">
<ScriptAction Script="doSomething(**update1's ID**);" />
</Parallel>
</OnUpdating>
...
</Animations>
</cc1:UpdatePanelAnimationExtender>
与
**编辑*
要添加到Tim的解决方案中,如果每页有多个自定义控件,请迭代页面控件,并为自定义控件类型的每个控件添加一个注册脚本 你试过使用它的ClientID吗
Script="doSomething('<%= update1.ClientID %>');"
如果这也不起作用,尝试使用相同的方法,但从代码隐藏(页面加载)
是的,这将工作,但不幸的是,对我来说,updatepanel是在一个自定义控件中,每个页面可能有多个。但是,我会接受你的答案,因为它会起作用。^^:我不知道你的
doSomething
-函数做什么,但是你不能通过RegisterClientScriptBlock注册该函数,并用'
将UpdatePanel的ClientID添加到该函数中吗?这样,就不需要将id作为参数传递。
Exception type: System.Web.HttpParseException
Exception message: The 'Animations' property of 'cc1:UpdatePanelAnimationExtender' does not allow child objects.
<ScriptAction Script="doSomething('<%=update1.ClientID %>');" />
Script="doSomething('<%= update1.ClientID %>');"
<script type="text/javascript"> var update1ClientID = '<%= update1.ClientID %>';</script>
Script="doSomething('' + update1ClientID );"
ScriptManager.GetCurrent(Me.Page).RegisterClientScriptBlock(Me, Me.GetType, "update1ClientID", "var update1ClientID='" & Me.update1.ClientID & "';", True)