We help IT Professionals succeed at work.

Ajax Tab Control Render question

No1Coder
No1Coder asked
on
I am using the Ajax tab control in an asp.net application.  I am running some javascript on the page load event of the page to do fixup on grids on the tab.  My code depends on offsetWidth of some of the components on the page.  When the ajax tab is not visible, all the offset widths (for controls on that page) are = 0, which is not correct (which breaks my code).

I can fix by running my script when the tab changes, instead of page load.  I want to do this without a postback.  What event can I hook into on the client side?

Alternatively, is there a way to force the tab control to render non-visible tabs.
Comment
Watch Question

BRONZE EXPERT

Commented:
idea:

you can use jQuery / javascript which can control tabs for visibility or invisibility after page load and before html renders on browser.

use - Display = none property.

Author

Commented:
can you explain further?
BRONZE EXPERT
Commented:
You are using Ajax Tabs control and you want to execute some java-script code to be run on click of each tab.
For this:
If you see:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Tabs/Tabs.aspx

you will get noticed that ajax tabs has function built in which is called on client side on click of tab viz. OnClientActiveTabChanged

It also has another event called ActiveTabChanged which is called on server side.

Use first one event and call your java-script code to execute.

Hope this clears you.

Author

Commented:
I was able to fix this by putting code on the "OnClientPopulated" event.  I needed a post-render event.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.