9

How do I activate a different tab from a page in another tab and do a PostBack o...

 2 years ago
source link: https://www.codesd.com/item/how-do-i-activate-a-different-tab-from-a-page-in-another-tab-and-do-a-postback-on-it.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How do I activate a different tab from a page in another tab and do a PostBack on it

advertisements

I'm having trouble figuring out something that should be simple but I'm having trouble trying to figure it out.

I have a Page (Default.aspx) which contaiins a WebTab Control (Infragistics, but shouldn't matter really). Inside each Tab Control of the WebTab is another page, Page1.aspx, Page2.apx, so it's like this:

Default.aspx
WebTab
    WebTabControl(0)
        Page1.aspx <-- I'm in this codebehind after
                   calling __doPostBack from JavaScript
                   as I have a parameter from a WebDataGrid.
    WebTabControl(1)
        Page2.aspx <-- I want to open this page and pass it a parameter.

I'm in Page1.aspx codebehind doing a postback as I have a parameter that I need to pass to the next page, and I want to open Page2.apx which is inside the 2nd Tab.

Basically, I think I need to do the following steps. 1. Set the Active Tab to WebTabControl(1) 2. Give it the Parameter that I have for it to do something with.

I know I'll have to shoot myself once someone tells how to do it :-) Thanks!


Ok AFAICU, WebTab control has WebTab and each webtab has page. Try this:

  1. Add auto postback feature of the control. So as to call the next tab and it will automatically load the aspx page.
  2. If you do not need Postback then do one thing, on the click event or tab change event of the tab control add some parameter in the query string. Like page.aspx?tab=1. Now on the page load event, use the logic below

          1. Check if Request[tab] is not null.
          2. use int.tryparse and get the tab number.
          3. Now on the basis of the load the tab and the page.
             And make the tab active.
    
    

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK