jquery ui 选项卡在回发时重定向到 ASPX 页面
当我提交表单时,我被重定向到实际的 aspx 页面。 如何避免重定向。
tabs.aspx 中的Tabs.aspx
<div id="container-1">
<ul>
<li><a href="Survey.aspx?group=1"><span>HR</span></a></li>
<li><a href="Survey.aspx?group=2"><span>Sales</span></a></li>
<li><a href="Survey.aspx?group=3"><span>Finance</span></a></li>
</ul>
中的 jquery 代码代码隐藏
<script type="text/javascript">
$(function() {
$('#container-1 > ul').tabs();
</script>
Survey.aspx
<form id="form1" runat="server">
<div>
<asp:Label ID="lblHeading" runat="server"></asp:Label><br />
<asp:HiddenField ID="hdnGroupId" runat="server" />
<br />
1) Question 1 <asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
2) Another question: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<br />
<br />
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /><br />
<div id="Result">Click here for the time.</div>
<asp:Label ID="lblMessage" runat="server"></asp:Label></div>
</form>
调查页面
protected void btnSave_Click(object sender, EventArgs e)
{
if (groupId > 0)
{
switch (groupId)
{
case 1:
lblMessage.Text = "HR data is saved.";
break;
case 2:
lblMessage.Text = "Sales data is saved.";
break;
case 3:
lblMessage.Text = "Finance data is saved.";
break;
default:
break;
}
}
}
I am being redirected to the actual aspx page when I submit the form. How to avoid the redirection.
Tabs.aspx
<div id="container-1">
<ul>
<li><a href="Survey.aspx?group=1"><span>HR</span></a></li>
<li><a href="Survey.aspx?group=2"><span>Sales</span></a></li>
<li><a href="Survey.aspx?group=3"><span>Finance</span></a></li>
</ul>
jquery code in tabs.aspx
<script type="text/javascript">
$(function() {
$('#container-1 > ul').tabs();
</script>
Survey.aspx
<form id="form1" runat="server">
<div>
<asp:Label ID="lblHeading" runat="server"></asp:Label><br />
<asp:HiddenField ID="hdnGroupId" runat="server" />
<br />
1) Question 1 <asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
2) Another question: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<br />
<br />
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /><br />
<div id="Result">Click here for the time.</div>
<asp:Label ID="lblMessage" runat="server"></asp:Label></div>
</form>
Survey page Code behind
protected void btnSave_Click(object sender, EventArgs e)
{
if (groupId > 0)
{
switch (groupId)
{
case 1:
lblMessage.Text = "HR data is saved.";
break;
case 2:
lblMessage.Text = "Sales data is saved.";
break;
case 3:
lblMessage.Text = "Finance data is saved.";
break;
default:
break;
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
试试这个插件...
http://code.google.com/p/jquery-hijack/
Try this plugin...
http://code.google.com/p/jquery-hijack/