在我的asp.net程序中,我有3个选项卡,如
<div id="horizontalTab">
<ul class="resp-tabs-list" id="babTabs">
<li id="tab1">Feedback</li>
<li id="tab2">Complaints</li>
<li id="tab3">B2B</li>
</ul>
<div class="resp-tabs-container">
<div>
<!-- tab content -->
</div>
</div>
</div>
标签内部有一个gridview控件。选项卡正常工作并显示数据,但是当我单击gridview页面索引或gridview中的任何链接时,页面正在重新加载,活动选项卡将更改为第一个选项卡。
我需要在点击ul
时找到标签ID,并使用活动类设置该标签ID。我试过这个:
$(document).ready(function () {
var tes = "";
alert(tes);
$("#babTabs li").click(function () {
tes = $(this).attr('id');
if (tes != null) {
alert($(this).attr('id'));
$(tes).addClass("resp-tab-active");
}
});
});
但alert
没有显示任何价值。有人可以帮忙吗?提前谢谢。
答案 0 :(得分:0)
您必须使用“更新”面板并触发事件Asyncpostback,它允许您回发页面的特定部分
你可以做这样的事情...... <asp:UpdatePanel ID="gvid" runat="server">
<ContentTemplate>
<asp:GridView ID="GridID" runat="server" Width="100%" OnRowCommand="gvevent_RowCommand">
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="GridID" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel>