页面
<asp:UpdatePanel ID="asypnl" runat="server">
<ContentTemplate>
<asp:Wizard />
<StartNavigationTemplate>
</StartNavigationTemplate>
<FinishNavigationTemplate>
</FinishNavigationTemplate>
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server">
<asp:Panel runat="server" ID="pnlGiftInfo">
<td>
<asp:DropDownList ID="DropDownPayment" runat="server">
<asp:ListItem Selected="True" Value="0">Gift</asp:ListItem>
<asp:ListItem Value="1">Pledge</asp:ListItem>
</asp:DropDownList>
</td>
</asp:Panel>
</asp:WizardStep>
</WizardSteps>
<asp:Panel runat="server" ID="pnlOutput">
<%-- Content comes from the database OutputHtml Colunm--%>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
数据库列
<p>Thank you for your <span id "ddlGift">gift</span><span id "ddlPayment">payment</span> of
{Amount} to the {Comm}
<script type="text/javascript" language="javascript">
var p = document.getElementById("DropDownPayment");
var eledropdownPayment = p.options[p.selectedIndex].value;
var ddlGift = document.getElementById("ddlGift");
var ddlPayment = document.getElementById("ddlPayment");
if (eledropdownPayment == "0") {
ddlGift.style.display = "block";
ddlPayment.style.display = "none";
} else {
ddlGift.style.display = "none";
ddlPayment.style.display = "block";
}
</script>
在向导 ctrl 中提交最后一步后,我将使用数据库内部构建的 Html 标记结构来显示结果。一切正常,除了数据库中的脚本没有执行,所以我可以看到两个跨度文本。我只想根据下拉选择选择跨度。我无法在 aspx 中编写脚本,因为这些跨度标签在页面加载事件中不存在,它们在完成向导 ctrl 中的 2 个步骤后进入输出面板。我需要一些方法来根据下拉选择显示 sapn...谢谢。抱歉,描述太长了。