Ajax Tabcontainer and JQuery
Hi,
I have a question for you.
In my asp.net web site I have a masterpage. In that masterpage I have a menu that consists of a tab container (ajax control toolkit). This tab container is built in code behind dynamically in page init. The tab container consists of multiple tabs, each tab contains a BulletedList and each BulletedList have at least one List Item. Each List Item has a value that is a url that points to as aspx web form.This web form's MasterPageFile points to my master page. I have added a javascript function on the tab container's OnClientActiveTabChanged event and this fires each time one tab is clicked.
The attachment contains the method that builds the menu.
What I want to do is that when the user clicks on one of the tabs, I want to retrieve one spesific url in one of the list items that "belongs" to the tab that was clicked. How to do that in JQuery?
I have managed it halfway, but I think my approach sucks big time. Surely JQuery can do it in a better way?
This is my javascript method:
function activeTabChanged(sender, e)
{
var activeTab = sender.get_activeTab();
var activeTabHeaderText = activeTab.get_headerText();
// How to get the div.header li from the activeTab and not from the document?
// This will give me all relevant li elements in the whole document and I only
// want the li elements that is inside activeTab. (the tab that was clicked by the user)
var links = $(document).find("div.header li");
for (var i = 0; i < links.length; i++)
{
var e = links[i];
var link = $(e).find("a").attr("href");
// to find the link I want to use I have to search in the href attribute
// the url has to contain the string that is the input parameter to the indexOf function.
var index = link.indexOf("ArkivdelSearch.aspx?isBaseClassSearch=true&baseclass=" + activeTabHeaderText,0);
if (index != -1)
{
window.location.href = link;
return false;
}
}
}
Can you help me to "translate this to JQuery?
Best regards,
OKB