我试过了:
但它不起作用
这是我的代码,aspx:
<div id='settingNev' >
<ul >
<li><a onserverclick="show_view1" runat="server"><span>changeView1</span></a></li>
<li><a onserverclick="show_view2" runat="server"><span>changeView2</span></a></li>
</ul>
</div>
代码背后的代码:
protected void show_view1(object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex = 0;
}
protected void show_view2(object sender, EventArgs e)
{
this.MultiView1.ActiveViewIndex = 1;
}
aspx,意见:
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
View1
</asp:View>
<asp:View ID="View2" runat="server">
View2
</asp:View>
</asp:MultiView>
还有其他方法吗?或者你能在代码中看到问题吗?
Tnx的帮助:D
答案 0 :(得分:1)
将LinkButton与其OnClick事件一起使用。 http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx
<asp:LinkButton id="LinkButton1"
Text="Click Me"
OnClick="LinkButton_Click"
runat="server"/>
背后的代码
protected void LinkButton_Click(Object sender, EventArgs e)
{
Label1.Text="You clicked the link button";
}