Read innerHTML

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
Is there any way to read the innerHTML of a label control when the page post back in C#?
Question by:michael1174
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Expert Comment

ID: 26293320
What do you mean by innerHTML?
Is it lable text?
Could you post a bit clear?

Author Comment

ID: 26293355
There is a value assigned to a label control via lblControl.innerHTML.  I need to get that value and assign it a variable on a button click.
LVL 40

Expert Comment

by:Richard Quadling
ID: 26293372
Unless the same code was responsible for creating the label to start with, then not as standard.

The data returned to the server is controlled by the server and the client. It does not normally contain static elements (like lablel contents), only dynamic elements like input, select, textareas.

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

LVL 21

Accepted Solution

silemone earned 2000 total points
ID: 26293384
you could do this easily with javascript...

see <asp:labels = spans...

anyway, do something like

var ele = document.getElementById("<%=labelID%>");

var hidEle = document.getElementByID("<%=hidFieldID %>");
hidEle.value = ele.innerHTML;
LVL 11

Expert Comment

ID: 26293473
But the author said to get it in PagePostBack.
LVL 21

Expert Comment

ID: 26293502
rajvia, he could technically still get it in the pagePostback...just read the hidden field then...the hidField i used is the server version...

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question