Determine which tab an action was called from?
<p>I'm editing some code which wasn't written by myself but someone who's no longer here.</p>

<p>The page I'm editing had three tabs, each tab contains a diffrent  grid view which is populated by a search box with in the tab. Each row in the grid view has a check box. When a print button is pressed all records with a tick in the check box should be printed off. Then page then reloads but some of the content is missing due to the way the page has been coded. </p>

<p>This is becuase some of the code is only called when the tab is clicked not on postback. Is there anyway that I change the following code so that it's called after postback?</p>

<p>These are the functions that are causing the most problem.. I need them to be loaded for the correct tab on postback.. I can't do it for all three as the code takes forever to run in that case. </p>

<p>AddActionsToGridView(gvGlobal);
AddCheckboxesToGridView(gvGlobal);</p>

<pre><code>    {
        if (tabconConsignments.ActiveTabIndex == 0)
       {
            dtGlobalIDConsignments = fGenerateTableSQL(astrPalletIDs, DateFrom, DateTo, ddlReqColDel.SelectedValue, "GlobalID", "", "");

            //Global ID Tab
            gvGlobal.DataSource = dtGlobalIDConsignments;
            gvGlobal.DataBind();

            //Actions
            AddActionsToGridView(gvGlobal);
            AddCheckboxesToGridView(gvGlobal);

       }
      else if (tabconConsignments.ActiveTabIndex == 1)
       {

            dtCreatedDateConsignments = fGenerateTableSQL(astrPalletIDs, DateFrom, DateTo, ddlReqColDel.SelectedValue, "CreatedDate", "", "");

            //Created Date Tab
            gvCreationDate.DataSource = dtCreatedDateConsignments;
            gvCreationDate.DataBind();
            tbCreationDateSearch.Text = "";

            //Actions
            AddActionsToGridView(gvCreationDate);
            AddCheckboxesToGridView(gvCreationDate);

        }
        else if (tabconConsignments.ActiveTabIndex == 2)
        {
                dtAccountsConsignments = fGenerateTableSQL(astrPalletIDs, DateFrom, DateTo, ddlReqColDel.SelectedValue, "Account", "", "");

                //Account Tab
                gvAccount.DataSource = dtAccountsConsignments;
                gvAccount.DataBind();

                AddActionsToGridView(gvAccount);
                AddCheckboxesToGridView(gvAccount);
            }
</code></pre>

<p>Please let me know if you want me to post any more code or any more info it's been a hard one for me to get my head around so I might of missed something out.  Thank you for any help you can provide. </p>
