This is a migrated thread and some comments may be shown as answers.

set selected tab strip to previous

1 Answer 33 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 07 Feb 2014, 04:23 PM
I need to do error checking on a page and it happens on the selectedtabevent.  If the page errors out I need them to stay on teh current tab and not go forward until they have picked what they need to do.  So I thought i could se tthe selected index but it seems not to work.  Is there another way to do this?

function CheckValidation(sender, args) {
           var tab1 = sender.get_selectedIndex();
           if (tab1 == 1) {
               var combo = $find('<%= ddlSoldCounty.ClientID %>');
               var item = combo.get_value();
               if (item = 0)  {
                   if (tab1 == 1) {
                       //Set the selected tab back to 0
                       tab1.sender.set_selectedIndex == 0;
                   }
                   alert('You must pick a county from Drop Down List');
               }
           }
       }

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Feb 2014, 04:05 AM
Hi Kevin,

Please have a look into the following JavaScript to achieve your scenario.

JavaScript:
<script type="text/javascript">
    function CheckValidation(sender, args) {
        //your condition
        if (sender.get_selectedIndex() == 1) {
            sender.set_selectedIndex(0);
        }
    }
</script>

Thanks,
Shinu.
Tags
TabStrip
Asked by
Kevin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or