[RESOLVED] Do TabPanels in a TabContainer have click events etc

Hi,

I have a TabContainer with 2 TabPanels. In TabPanel1 I have a AsyncFileUpload control.

This AsyncFileUpload must be Visible="false" as I have ActiveTabIndex="1" in the TabContainer. If not, there will be a compile error when trying to access the Page.

Now when I click the Tab of TabPanel1, this AsyncFileUpload controls needs to be Visible="true".

 

I am not sure how I can achieve this. Has TabPanels some kind of click event etc?

<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1"
                        CssClass="fancy" Font-Names="Arial" Width="787px">
<cc1:TabPanel runat="server" ID="TabPanel1" Height="100%" HeaderText="TabPanel1" >
    <HeaderTemplate>
        Tab1
    </HeaderTemplate>
<ContentTemplate>
<cc1:AsyncFileUpload ID="AsyncFileUpload1" runat="server"
                        FailedValidation="False" OnClientUploadComplete="UploadComplete"
                        OnClientUploadError="uploadError" OnClientUploadStarted="StartUpload"
                        UploaderStyle="Modern"
                        UploadingBackColor="#66CCFF" Visible="False" Width="320px" />
</ContentTemplate>
</cc1:TabPanel>








<cc1:TabPanel runat="server" ID="TabPanel2" Height="100%" HeaderText="TabPanel2" >
<ContentTemplate>
    <HeaderTemplate>
        Tab2
    </HeaderTemplate>
<ContentTemplate>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>


 

Try this one <cc1:TabContainer onactivetabchanged="tabProductInfo_ActiveTabChanged" ID="tabProductInfo" runat="server" ActiveTabIndex="0" Width="100%" ScrollBars="Auto" >

Thank you, it seems interesting. I have to ask a bit more.

This should be a C# event as I understand: onactivetabchanged="tabProductInfo_ActiveTabChanged"

 

If it is, how would that event look like to know I am setting it up correctly?

Thank you! 

Hi,

I am not sure but I beleive there must be a C# event for this onactivetabchanged but are not sure how to set that event handler up in C#?

<cc1:TabContainer onactivetabchanged="tabProductInfo_ActiveTabChanged" ID="tabProductInfo" runat="server" ActiveTabIndex="0" Width="100%" ScrollBars="Auto" >


 

You can just add this event to your code behind,  

        protected void tabProductInfo_ActiveTabChanged( object sender, EventArgs e )
        {

        }
 
or
 
If you are lazy like me, get the tab control in your properties explorer in the designer, then  click the little lightening bolt icon at the top of the properties explorer.
This will then display all the server events for the control.  Next just double click the empty input box next to the event you need, in your case ActiveTabChanged.  
VS should then create and name the event for you and show display it in the codebehind page.  This is very handy for any server control event you want to create.
 

Thank you, then I understand how you ment.

I think I have set it up as it should be then.

It seems to work out fine.

 

Thank you!

<cc1:TabContainer id="tabconLandTransPlan" runat="server" Width="806" onactivetabchanged="tabProductInfo_ActiveTabChanged" AutoPostBack="True"
                  ActiveTabIndex="4" CssClass="fancy" Font-Names="Arial" >




    protected void tabProductInfo_ActiveTabChanged(object sender, EventArgs e)
    {
        if (tabconLandTransPlan.ActiveTabIndex == 1)
        {
            AsyncFileUpload1.Visible = true;
            AsyncFileUpload2.Visible = true;
        }
        else
        {
            AsyncFileUpload1.Visible = false;
            AsyncFileUpload2.Visible = false;
        }
    }


 

thoughts on "[RESOLVED] Do TabPanels in a TabContainer have click events etc "

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>