473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to set innerHTML of an asp Label control

I want to use a asp Label control (or a <div runat=server> element) in a
template column of a datagrid. In the code behind in the grid's
ItemDataBound event I need to dynamically set the innerHTML of this control
with data and line breaks (<br>).

The problem is that while working in the code behind, I don't see any
properties for this control where I can set innerHTML, only text.

Any good ideas?

--
mo*******@nospam.com
Nov 18 '05 #1
1 11263
Hi Moondaddy,

As for the problem how to set the innerHTML of a ASP Label Control. I think
you can directly use its "Text" property. For example:

if we have a Label control as below:
<asp:Label id="lblHtml" runat="server"></asp:Label>

Then in code behind, we can set its innerHtml like this:
lblHtml.Text = "<table width='200'
border='1'><tr><td>content</td></tr></table>";

So the only thing we need to do is just retrieve the certain Label Control
from the certain cell in the DataGrid in
its ItemDataBound event and then use its "Text" property to set the
innerHtml. Please have a try to see whether this helps. Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lendle | last post by:
I have defined onclick event handler within the innerHTML property as following: var testButton1=oWin.document.createElement("LABEL"); testButton1.innerHTML="<input type='button' value='xx'...
3
by: nLella | last post by:
Hello, Is there any way where, from server side, I can access the innerHTML value of a control (Hyperlink/Label) which is modified at the client side ? I wish to read the changed InnerHtml on...
14
by: nickdevx | last post by:
Without knowing "html before" and "html after" can anyone fathom any reason why the following code crashes IE but if I add <br/> after ANY <input> tags it doesn't? ...
1
by: moondaddy | last post by:
I want to use a asp Label control (or a <div runat=server> element) in a template column of a datagrid. In the code behind in the grid's ItemDataBound event I need to dynamically set the innerHTML...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
7
by: MaryA | last post by:
Let me preface this with the fact that I am a newbie to HTML, XML and Javascript. Having said that, let me explain my dilemma: I am having a difficult time getting innerHTML to consistently...
7
by: Nez | last post by:
Help needed! Hello, I have looked everywhere for a solution to my problem and this is pretty much my last resource. I have created a table in a span with the innerhtml command in my code behind....
4
by: poojak | last post by:
I have write two different js function in a external file. one function write a table (I used innerHTML for this.) and another function is for showing/ hideing some rows depending on radio button...
2
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i'm in a gridview edit row that has a DropDownList in one column and a status Label in the 2nd column. When i changed the value in the dropdownlist, there's a client-side javascirpt...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.