How to set ActiveTabIndex of TabContainer?

Last post 05-08-2007 9:10 AM by omee4u. 1 replies.

Sort Posts:

  • How to set ActiveTabIndex of TabContainer?

    04-30-2007, 4:56 PM
    • Member
      point Member
    • vsusi
    • Member since 04-30-2007, 5:10 PM
    • Posts 1

    I am just trying to set the tab index for Tab Container using ActiveTabIndex. But it gives an error saying that the Tabcontainer1 is not declared.

    Script Below

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    TabContainer1.ActiveTabIndex = Session("TabIndex")

    End Sub

    ASP .Net code

    <CC1:TABCONTAINER ID="TabContainer1" RUNAT="server" >

     

    Filed under:
  • Re: How to set ActiveTabIndex of TabContainer?

    05-08-2007, 9:10 AM
    • Member
      4 point Member
    • omee4u
    • Member since 05-08-2007, 6:25 AM
    • Posts 2

    Hi,

    First, place any other control on the form and try to access it in code. if u cant then that may be because initially Website Project was created and now being encorporated into Visual Basic Website Project. Visual Basic Website Project generates an additional resource file in which all controls are declared which is not the case when u create a Website like File + New + Website. at lease thats what i have experienced. if this is the case then try this same code in a website project (like File + New + Website) not like File + New + Project + Visual Basic/Visual C# + Web + Website.

    If ur problem is not addressed or solved by above. For server side scripting your code should run fine. Client Side java scripting is another thing.

    <

    cc1:TabContainer ID="TabContainer1" runat="server" Height="199px" Width="332px">

    To access the above mentioned container in client side java script Use the following where ever u need to access it.

    $find(

    '<%=TabContainer1.ClientID%>')

    this would give u the container control in java script, if u c the View Source of rendered page u will c that client names are some what changed from server name.

    To Set tab index in client side java script use

    $find(

    '<%=TabContainer1.ClientID%>').set_activeTabIndex(1);

     im using 1 in my scenario. i had a text box in second page at index 1 and performing a batch validation and save process, so needed to bring page and control in view + focus to prompt user of invalid input. i think control in tab page of this container are also not directly accessible. use the following to do just that.

    ctl=document.getElementById(

    "<%=Textbox5.ClientID%>");

    ctl.focus();

    Hope this helps.

    Regards

    Omer Sultan

Page 1 of 1 (2 items)