问题描述
亲爱的开发人员,
我需要jquery或javascript tabcontrol中的示例.我需要在jquery或javascript tabcontrol中引发tabchanged事件,因为单击第一个选项卡中的第二个tab..1文本框和第二个选项卡中的另一个文本框时,需要将值从一个文本框复制到另一个文本框.无法使用Ajax控件.任何样品或编码请...
这是我的编码.单击单击选项卡时引发按钮单击事件.但是回发时不保留该选项卡...
Dear Developer,
I need a sample in jquery or javascript tabcontrol. I need to raise tabchanged event in jquery or javascript tabcontrol, beacause i need to copy the value from one text box to another when click the 2nd tab..1 textbox in first tab and another in 2nd tab.Am unable to use Ajax controls.Any samples or codings pls...
This is my coding..The button click event is raised when click the tab..but the tab in not retained when postbacks...
<style type="text/css">
body
{
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.tab-box
{
border-bottom: 1px solid #DDD;
padding-bottom: 5px;
}
.tab-box a
{
border: 1px solid #DDD;
color: #666666;
padding: 5px 15px;
text-decoration: none;
background-color: #eee;
}
.tab-box a.activeLink
{
background-color: #fff;
border-bottom: 0;
padding: 6px 15px;
}
.tabcontent
{
border: 1px solid #ddd;
border-top: 0;
padding: 5px;
}
.hide
{
display: none;
}
.small
{
color: #999;
margin-top: 100px;
border: 1px solid #EEE;
padding: 5px;
font-size: 9px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$(".tabLink").each(function () {
$(this).click(function () {
tabeId = $(this).attr('id');
$(".tabLink").removeClass("activeLink");
$(this).addClass("activeLink");
$(".tabcontent").addClass("hide");
$("#" + tabeId + "-1").removeClass("hide")
alert(tabeId);
eval("<%=raja %>");
return false;
});
});
});
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnNext" runat="server" Text="Next" />
<div class="tab-box">
<a href="java<!-- no -->script:;" class="tabLink activeLink" id="cont-1">Tab 1</a> <a href="java<!-- no -->script:;">
class="tabLink " id="cont-2">Tab 2</a> <a href="java<!-- no -->script:;" class="tabLink " id="cont-3">
Tab 3</a>
</div>
<div class="tabcontent" id="cont-1-1">
<asp:TextBox ID="TextBox1" runat="server">
<asp:Button ID="btn" Text="Save" runat="server" OnClick="btn_Click" />
This is content box one
</div>
<div class="tabcontent hide" id="cont-2-1">
<asp:TextBox ID="TextBox2" runat="server">
This is content box Two
</div>
<div class="tabcontent hide" id="cont-3-1">
This is content box Three
</div>
</div>
<asp:HiddenField runat="server" ID="HFCurrTabIndex" />
</form>
</body>
C#中的代码背后;;
Code Behind in C#;;
protected void Page_Load(object sender, EventArgs e)
{
//ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
raja = Page.ClientScript.GetPostBackClientHyperlink(btn,"",false);
}
protected void btn_Click(object sender, EventArgs e)
{
//ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
ImageButtonClickHandler();
}
private void ImageButtonClickHandler()
{
TextBox2.Text = TextBox1.Text;
//ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "a", "a()", false);
//ClientScript.RegisterStartupScript(Page.GetType(), "transfer()", "$('#cont-2').click();", true);
}
它不起作用..
Its not working..
推荐答案
这篇关于怀疑Tabcontrol?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!