set selected tab strip to previous

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 07 Feb 2014 Link to this post

    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');
                   }
               }
           }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Feb 2014 in reply to Kevin Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top