Currently, I am utilizing Telerik UI for asp.net, specifically making use of RadTabStrip with partial page postbacks to navigate through various sets of data. When a user clicks on a tab, certain code runs to load data specific to that tab.
I have successfully implemented codebehind execution by setting the OnTabClick property of the RadTabStrip and then checking the clicked tab in the codebehind.
For instance:
protected void tab_Click(object sender, RadTabStripEventArgs e)
{
if (e.Tab.Text == "Info")
{
populateInfoTab();
}
}
private void populateInfotab()
{
// Perform necessary actions
}
However, I am facing challenges in executing client-side JavaScript after clicking on a specific tab. Here's what I've attempted:
I set the OnClientTabSelected property and added some JavaScript like so:
function tab_ClientClick(sender, args)
{
var tab = args.get_tab();
if(tab.get_text() == "Info")
{
alert("Tab Clicked");
}
}
The issue arises when I need to manipulate the InnerHtml of a particular div within the clicked pageview after it has been selected. Since the div is not present during the initial page load (the specific RadPageView is hidden), I cannot modify it at that time. Once the user clicks into the tab and the page view loads, I must be able to update the div's InnerHtml using JavaScript.
What would be the most effective approach to achieve this functionality?