Example #1
0
        /// <summary>
        /// Sets a selected tab index (used in admin area to store selected tab index)
        /// </summary>
        /// <param name="tabStripBuilder">TabStripBuilder</param>
        /// <param name="index">Tab index</param>
        /// <returns>TabStripBuilder</returns>
        public static TabStripBuilder SetSelectedTabIndex(this TabStripBuilder tabStripBuilder, int index)
        {
            if (tabStripBuilder == null)
            {
                throw new ArgumentNullException("tabStripBuilder");
            }

            //ensure it's not negative
            if (index < 0)
            {
                index = 0;
            }

            //ensure tab has required number of tabs
            //otherwise, nothing could be selected
            var totalTabs = tabStripBuilder.ToComponent().Items.Count;

            if (index >= totalTabs)
            {
                index = 0;
            }

            tabStripBuilder.SelectedIndex(index);

            return(tabStripBuilder);
        }
        public TabStripBuilderTests()
        {
            Mock<TextWriter> textWriter = new Mock<TextWriter>();
            Mock<HtmlTextWriter> writer = new Mock<HtmlTextWriter>(textWriter.Object);

            _tabStrip = TabStripTestHelper.CreateTabStrip(writer.Object, null);
            _builder = new TabStripBuilder(_tabStrip);
        }
Example #3
0
        public TabStripBuilderTests()
        {
            Mock <TextWriter>     textWriter = new Mock <TextWriter>();
            Mock <HtmlTextWriter> writer     = new Mock <HtmlTextWriter>(textWriter.Object);

            _tabStrip = TabStripTestHelper.CreateTabStrip(writer.Object, null);
            _builder  = new TabStripBuilder(_tabStrip);
        }