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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:15:39+00:00 2026-06-05T09:15:39+00:00

I have a javascript that gets the value of the cursor position and it

  • 0

I have a javascript that gets the value of the cursor position and it works well. Am assigning that value to asp.net label’s innerHtml property. When there s a treeview_selectednodechange event happening i want to access this innerHtml property in my program. How can this be achieved?

this is the javascript am using:-

function ShowSelection() {
        var txt1 = document.getElementById("MainContent_txtQuery");
        var currentRange = document.selection.createRange();
        var workRange = currentRange.duplicate();
        txt1.select();
        var allRange = document.selection.createRange();
        var len = 0;
        while (workRange.compareEndPoints("StartToStart", allRange) > 0) 
        {
            workRange.moveStart("character", -1);
            len++;
        }
        currentRange.select();
        document.getElementById("MainContent_lblPos").innerHTML = len;
    }

And the place where i want to access it is:-

 string[] selectedNode = treeViewTables.SelectedNode.Text.Split('<', '>');

            string pos = lblPos.Text;
            if (selectedNode[2].Equals("Table(s)") || selectedNode[2].Equals("Parameter(s)"))
            {
                return;
            }
            string parentNode = treeViewTables.SelectedNode.Parent.Text;

            if (parentNode.Contains("Table(s)"))
            {
                txtQuery.Text = txtQuery.Text + " " + selectedNode[2];
                txtQuery.Text = RemoveSpaces(txtQuery.Text);
            }
            else if (parentNode.Contains("Parameter"))
            {
                //if (txtQuery.Text != "")
                if (lblPos.Text == string.Empty)
                {
                    if (txtQuery.Text.Length == 0)
                    {
                        txtQuery.Text = selectedNode[2];
                    }
                    else if (txtQuery.Text[txtQuery.Text.Length - 1] != ',')
                    {
                        txtQuery.Text = txtQuery.Text + " " + "'" + selectedNode[2] + "'";
                        txtQuery.Text = RemoveSpaces(txtQuery.Text);
                    }
                    else
                    {
                        txtQuery.Text = txtQuery.Text + " " + selectedNode[2];
                        txtQuery.Text = RemoveSpaces(txtQuery.Text);
                    }
                }

            }
            else
            {
                txtQuery.Text = txtQuery.Text + " " + selectedNode[2] + ",";
                txtQuery.Text = RemoveSpaces(txtQuery.Text);
            }
            TreeNode nodeSelected = treeViewTables.Nodes[0];
            nodeSelected.Select();

please help.

Thank You

  • 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-06-05T09:15:41+00:00Added an answer on June 5, 2026 at 9:15 am

    The content of a label (span on client side) will never be posted back to the server.

    Add an <asp:HiddenField> and set the its value on client side, at the same time that you change the innerHtml of the label. This value will be automatically available on server side.

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

Sidebar

Related Questions

I have a webpage that contains ASP.NET panels and JavaScript that gets all of
I have a javascript function updateHiddenField(value) that gets a value as parameter and then
I have some JavaScript to toggle a dropdownlists in a ASP.NET page, which gets
I have a bit of javascript code that gets and sets the scroll position
I have the following JavaScript code that gets the Id property (Guid) from every
I have a javascript that displays a generated text into a div: document.getElementById('phrase').innerHTML =
I have a javascript that is executed with the onchange event. onchange=showUser(1, this.value) The
i have a javascript object, obj , that gets passed to an mvc action
I have a php form that gets validated through javascript. I would like to
I have a Javascript function that works in IE7, but is giving me trouble

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.