Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8246185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:25:15+00:00 2026-06-07T22:25:15+00:00

I am working on a tabbed page (4 tabs – tab container) where 2

  • 0

I am working on a tabbed page (4 tabs – tab container) where 2 of them use the same control and have a different gridview with different dats sources which can edit and add items.

Editing and adding items works fine, however when I add an item the gridview or page needs to refresh or update to display the new item. Using Response.Redirect only refreshes the page and redirects to the first tab. I am working on tabs 2 and 3 and the redirect needs to point to the relevant tab, not always the 1st tab.

Any suggestion on how to do this?

I am using Visual Studio 2010, C# ASP.Net

CODE:

PAGE:

<asp:Content ID="Content2" ContentPlaceHolderID="pnlMainContent" runat="server">
<div style="padding: 10px">
    <cc1:TabContainer ID="tbMain" runat="server" ActiveTabIndex="0" Width="100%" AutoPostBack="true"
        OnActiveTabChanged="tbMain_ActiveTabChanged">
        <cc1:TabPanel runat="server" ID="tbpgWFTypes" HeaderText="Work Flow Types">
            <ContentTemplate>
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                             <uc1:ctrlWorkflowTypeControl ID="ctrlWorkflowTypeControl" runat="server" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </cc1:TabPanel>
        <cc1:TabPanel runat="server" ID="tbpgWFStatus" HeaderText="Work Flow Status">
            <ContentTemplate>
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                            <uc2:ctrlStatusControl ID="ctrlStatusControl" runat="server" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </cc1:TabPanel>
        <cc1:TabPanel runat="server" ID="tbpgWFActions" HeaderText="Work Flow Actions">
            <ContentTemplate>
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                            <uc3:ctrlActionControl ID="ctrlActionControl" runat="server" />                                
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </cc1:TabPanel>
        <cc1:TabPanel runat="server" ID="tbpgWFRouting" HeaderText="Work Flow Routing">
            <ContentTemplate>
                <table style="width: 100%">
                    <tr>
                        <td align="center">
                           <uc4:ctrlWorkflowRoutingControl ID="ctrlWorkflowRoutingControl" runat="server" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </cc1:TabPanel>
    </cc1:TabContainer>
</div>

CODE BEHIND:

protected void Page_Load(object sender, EventArgs e)
    {
        tbpgWFTypes.Focus();
        if (!IsPostBack)
        {
            tbMain_ActiveTabChanged(tbMain, null);                                       
        }           
    }

protected void tbMain_ActiveTabChanged(object sender, EventArgs e)
{
    try
    {
        if (tbMain.ActiveTabIndex == 1)
        {
            ctrlActionControl.ActionPanelMode = true;
            ctrlStatusControl.StatusPanelMode = false;
        }

        if (tbMain.ActiveTabIndex == 2)
        {
            ctrlStatusControl.StatusPanelMode = true;
            ctrlActionControl.ActionPanelMode = false;
        }                
    }
    catch (Exception ex)
    {
        Support.ExceptionHandler.HandleException(ex);
    }
  }
}

CONTROL:

 <table>
    <tr>
        <td align="left" colspan="2">
            <asp:DropDownList ID="ddlWFStatus" runat="server" Width="400px" DataSourceID="dsStatus" DataTextField="Description" Visible="false"></asp:DropDownList>
            <asp:DropDownList ID="ddlWFAction" runat="server" Width="400px" DataSourceID="dsAction" DataTextField="Description" Visible="false"></asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td  colspan="2"></td>
    </tr>
    <tr>
        <td align="left"  colspan="2">
        <asp:Panel ID="pnlStatus" runat="server" Visible="false">
            <asp:GridView ID="gvStatus" runat="server" DataSourceID="dsStatus"
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="WFStatusID"
             ForeColor="#333333" EnableSortingAndPagingCallbacks="True" AllowPaging="True" 
                AllowSorting="True" onselectedindexchanged="gvStatus_SelectedIndexChanged">
               <Columns>
                <asp:BoundField DataField="WFStatusID" HeaderText="WFStatusID" SortExpression="WFStatusID" Visible="false">
                    <ItemStyle HorizontalAlign="Left" Width="400px" /> 
                </asp:BoundField>
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description">
                    <ItemStyle HorizontalAlign="Left" Width="400px" /> 
                </asp:BoundField>
               <asp:CommandField  ButtonType="Button" EditText="Edit" ShowEditButton="true" />
               </Columns>
              <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            </asp:Panel>
             <asp:Panel ID="pnlAction" runat="server" Visible="false">
            <asp:GridView ID="gvAction" runat="server" DataSourceID="dsAction"
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="WFActionID"
             ForeColor="#333333" EnableSortingAndPagingCallbacks="True" AllowPaging="True" 
                AllowSorting="True" onselectedindexchanged="gvAction_SelectedIndexChanged">
               <Columns>
                <asp:BoundField DataField="WFActionID" HeaderText="WFActionID" SortExpression="WFActionID" Visible="false">
                    <ItemStyle HorizontalAlign="Left" Width="400px" /> 
                </asp:BoundField>
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description">
                    <ItemStyle HorizontalAlign="Left" Width="400px" /> 
                </asp:BoundField>
               <asp:CommandField  ButtonType="Button" EditText="Edit" ShowEditButton="true" />
               </Columns>
              <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            </asp:Panel>
        </td>
    </tr>
    <tr>
        <td align="left"  colspan="2">
            <asp:Button ID="btnShowAddSection" runat="server" Text="" onclick="btnShowAddSection_Click"/>
        </td>
    </tr>
    <tr id="divAddEditRow" runat="server" visible="false">       
        <td><asp:Label ID="lblAdd" runat="server" Text="New Item: " />  
            <asp:TextBox ID="txtEdit" runat="server" ></asp:TextBox>
        </td>
        <td>
            <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" style="float: right; padding-right:5px; margin-right:8px"/>
        </td>
    </tr>    
</table>

<asp:ObjectDataSource ID="dsStatus" runat="server" SelectMethod="FillWFStatus" UpdateMethod="UpdateWFStatus"
 TypeName="***.**.Services.WorkflowDataService" onupdating="dsStatus_Updating">
 <UpdateParameters>
    <asp:Parameter Type="Int32" Name="WFStatusID" />
    <asp:Parameter Type="String" Name="Description" />
 </UpdateParameters>
</asp:ObjectDataSource>

 <asp:ObjectDataSource ID="dsAction" runat="server" SelectMethod="FillWFAction" UpdateMethod="UpdateWFAction"
 TypeName="***.**.Services.WorkflowDataService" onupdating="dsAction_Updating">
 <UpdateParameters>
    <asp:Parameter Type="Int32" Name="WFActionID" />
    <asp:Parameter Type="String" Name="Description" />
 </UpdateParameters>
</asp:ObjectDataSource>

CODE BEHIND:

protected void Page_Load(object sender, EventArgs e)
    {  
    }

protected void gvStatus_SelectedIndexChanged(object sender, EventArgs e)
{
    WorkflowDataService.InsertWFStatus(0, txtEdit.Text);
}

protected void gvAction_SelectedIndexChanged(object sender, EventArgs e)
{
    WorkflowDataService.InsertWFAction(0, txtEdit.Text);
}

public bool StatusPanelMode
{
    set { pnlStatus.Visible = !value;
    btnShowAddSection.Text = "Add New Status";
    ddlWFStatus.Visible = !value;
    }           
}

public bool ActionPanelMode
{
    set
    {
        pnlAction.Visible = !value;
        btnShowAddSection.Text = "Add New Action";
        ddlWFAction.Visible = !value;
    }
}

protected void btnShowAddSection_Click(object sender, EventArgs e)
{
    this.divAddEditRow.Visible = true;
    btnShowAddSection.Visible = false;
}

protected void dsStatus_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
    var test = gvStatus.SelectedIndex;
    var test2 = dsStatus.UpdateParameters[0];
}

protected void dsAction_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
    var test = gvStatus.SelectedIndex;
    var test2 = dsAction.UpdateParameters[0];
}

protected void btnAdd_Click(object sender, EventArgs e)
{
    this.divAddEditRow.Visible = false;
    btnShowAddSection.Visible = true;

    if (pnlStatus.Visible == true)
    {
        WorkflowDataService.InsertWFStatus(0, txtEdit.Text);
        //Response.Redirect("ManageRoutingPage.aspx?tab=2");   <--- This Doesnt Work                
    }
    if (pnlAction.Visible == true)
    {
        WorkflowDataService.InsertWFAction( 0, txtEdit.Text);
        Response.Redirect("ManageRoutingPage.aspx");  // <-- This goes back to tab 1 instead of 3
    }
  }            
}    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:25:16+00:00Added an answer on June 7, 2026 at 10:25 pm

    After all that, all I needed was the databind(); Like so….

    protected void btnAdd_Click(object sender, EventArgs e)
        {
    
            this.divAddEditRow.Visible = false;
            btnShowAddSection.Visible = true;
    
            if (pnlStatus.Visible == true)
            {               
                WorkflowDataService.InsertWFStatus(0, txtEdit.Text);
                gvStatus.DataBind();
            }
    
            if (pnlAction.Visible == true)
            {
                WorkflowDataService.InsertWFAction( 0, txtEdit.Text);
                gvAction.DataBind();
            }   
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use tabs on my page where clicking on each tab switches
I have a page with multiple tabs(jquery ui tabs) On the last tab I
I have a working tabbed interface right now, but the tabs are declared in
I have a page designed for tabbed page navigation. The top tabs are <li>
I have a page which is going to have multiple tabbed content boxes on
I am working on xcode4.3.2 and I have created tabbed Application 7 now i
I'm making a tabbed view application and using CloudMade's API. I have a working
I'm working with a tabbed interface and have the following jQuery function set up
I'm working pn an andorid app with a tabbed interface and in each tab
I have a search page with a tabbed panel, with a form within each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.