problem of changing values for tableCell element

M

Mr. x

Hello,
I have the following aspx code :

<form id = "main_form" runat = "server">

<asp:Table dir = "rtl" runat = "server">
<asp:TableRow>
<asp:TableCell id = "inner_message">&nbsp;</asp:TableCell>
</asp:TableRow>
</asp:Table>
</form>


How can I change the contents of the value of TableCell in the server side
script.

(What should I write in the following :
<script runat="server">
...
inner_message.innerHtml = "some message" ' doesn't work - what
should I put instead.
</script>
)

Thanks :)
 
K

Ken Cox [Microsoft MVP]

If you need to look for the tablecell according to its ID, here's a way that
will do it. It is much more efficient if you can just reference it by index
(such as tblrow.Cells(0) )

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim tblrow As TableRow
Dim tblcell As TableCell
Table1.GridLines = GridLines.Both
tblrow = Table1.Rows(0)
tblcell = tblrow.Cells _
(tblrow.Controls.IndexOf _
(tblrow.FindControl _
("inner_message")))
tblcell.Text = "Mr. X should use a friendlier name."
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top