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 7608269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:52:23+00:00 2026-05-31T00:52:23+00:00

I know this might be an odd situation but currently I need to mix

  • 0

I know this might be an odd situation but currently I need to mix javascript with server side code as follows:

 function PerformGlobalCallback(sender, value) {
        var index = hfCurrentTabIndex.Get("activeIndex"));
        window['<%= ((ASPxCallbackPanel)myTabControl.TabPages[index].Controls[0]).ClientInstanceName %>'].PerformCallback(sender + "|" + value);
    } 

where hfCurrentTabIndex is a hidden field which correctly holds the value of the current tab index.
I know I cannot simply put the “index” variable in the <%= %> section so I need to come up with a way to do it.

The reason I need this is because the myTabControl current tab index is somehow lost in between callbacks. Also, even though I store it in Session, I get null when I access it in the above code.

Please let me know if you have any insights. Appreciate your help.

  • 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-05-31T00:52:24+00:00Added an answer on May 31, 2026 at 12:52 am
    var clientInstanceNames = [];
    <%
        for(int x=0; x<myTabControl.TabPages.Count; x++) 
        {
            Response.Write("clientInstanceNames[" + x.ToString() + "] = \"" + (ASPxCallbackPanel)myTabControl.TabPages[x].Controls[0]).ClientInstanceName + "\";");
        }
    %>
    function PerformGlobalCallback(sender, value) {
        var index = hfCurrentTabIndex.Get("activeIndex"));
        window[clientInstanceNames[index]].PerformCallback(sender + "|" + value);
    } 
    

    That should do what you want.

    Server side code is processed first so the page gets sent to the client browser before the client browser processes the JavaScript. You could also use an AJAX call to get the .ClientInstanceName. But the way demonstrated above builds the JavaScript array on the server for you, so your client code just has to look-up the index.

    Note The code was written inside my browser window and is not tested, so syntax errors may exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this might seem odd for many Silverlight professionals, but alas, thats the
This might sound a bit of an odd question but I know what I
I know this questions might seem a little odd, but I want to make
I know this might seem a bit odd, but i have this requirement and
I know this might sound kinda odd, but I was wondering if it was
Know this might be rather basic, but I been trying to figure out how
I know this might seem like a duplicate, but I'm not getting anywhere with
I know this might be a stupid question, but here it goes. I always
I know this might be a long shot, but here it goes. I have
I know this might be a bit awkward but I am trying to modify

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.