开发者

Tab panel problem

How can I get selected tab index of tab panel using JavaScript and then assign a button validation group according to selected tab index?

This is my code so far:

function ActiveTab()
{
    var a= $find("tcEmployee").get_activeTabIndex();
    var add=document.setElementById('<%=btnAddRecord.ClientID%>');
    var update=document.getElementById('<%= btnUpdateRecord.ClientID%>');
    var delet  document.getElementById('<%= btnDeleteRecord.ClientID%>');
    if (a == 0)
    {
        add.ValidationGroup = "Insertion";
        update.ValidationGroup = "Insertion";
        delet.ValidationGroup = "Insertion";
    }
    else if (a == 1)
    {
        add.ValidationGroup 开发者_开发知识库= "Insertion1";
        update.ValidationGroup = "Insertion1";
        delet.ValidationGroup = "Insertion1";
    }
    else
    {
        add.ValidationGroup = "Insertion2";
        update.ValidationGroup = "Insertion2";
        delet.ValidationGroup = "Insertion2";
    }
}


You can try with Jquery tab.


Have you considered using a click event on the tab?

Maybe look at the jQueryUI tab control and get the event that way.

Also, try including more information in your question so we can actually target our answers to an actual problem

edit

OK, looking at your code i think jQuery is going to be your friend.

if you give each of your controls an ID like you are doing and also a class. So for the "add" alement you may give it a class of "ADD" and for"update" a class of "UPDATE".

Then you can use jQuery like this;

$(".UPDATE").click(function(){
  alert( $(this).attr("id") );
})
$(".ADD").click(function(){
  alert( $(this).attr("id") );
})

etc....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜