我在视图上有一个LinkButton
名为“退出聊天”。我将javascript
代码嵌入到OnClientClink=javascript:confirm('Are you sure you want to end the session?')
。但是,我无法管理对话框
当用户单击确定按钮时,视图应该被终止。我该怎么做?
<asp:LinkButton ID="LinkButton2" runat="server" Font-
Bold="False" Font-Underline="False"
OnClientClick="javascript:confirm('Are you sure you want to end the session?')"
ViewStateMode="Enabled" OnClick="LinkButton2_Click1" Text="Exit Chat">
</asp:LinkButton>
我写了这个代码部分但没有工作:(
if (LinkButton2.CommandName=="OK")
{
MultiView1.ActiveViewIndex = -1;
}
else if(LinkButton2.CommandName=="Cancel")
{
MultiView1.ActiveViewIndex = 1;
}