B
Bob
Hi,
I have already posted a similar problem but it 's still a problem for me, so
...
I define a table in aspx file and Javascript code.
Purpose: when the user clicks on any cell of the table, the text of it must
be rendered in an Alert.
<asp:Table ID="table1" runat="server">
</asp:Table>
<script language="javascript" type="text/javascript">
function tableclick(event)
{
strid=window.event.srcElement.id
alert(strid) // this works: i get e.g. 3:2
strid=window.event.srcElement.text}
alert(strid) // this doens't work ("undefined")
}
I create row and cells in the code-behind:
Dim r As TableRow
Dim c(50, 20) As TableCell
For i = 0 To 50
r = New TableRow()
For j = 0 To 20
c(i, j) = New TableCell()
c(i, j).ID = j & ":" & i.ToString
r.Cells.Add(c(i, j))
Next
Table1.Rows.Add(r)
Next
c(3, 2).Text = "this is the text i want in Javascript"
....
My problem is that the Alert gives "undefined".
I can get the 'ID' of each cell, why not the 'text'?
I know there is the property 'ClientID' but it's overruled by the ID i
defined in the code, so that's not the point (i think).
Thanks for help.
Bob
I have already posted a similar problem but it 's still a problem for me, so
...
I define a table in aspx file and Javascript code.
Purpose: when the user clicks on any cell of the table, the text of it must
be rendered in an Alert.
<asp:Table ID="table1" runat="server">
</asp:Table>
<script language="javascript" type="text/javascript">
function tableclick(event)
{
strid=window.event.srcElement.id
alert(strid) // this works: i get e.g. 3:2
strid=window.event.srcElement.text}
alert(strid) // this doens't work ("undefined")
}
I create row and cells in the code-behind:
Dim r As TableRow
Dim c(50, 20) As TableCell
For i = 0 To 50
r = New TableRow()
For j = 0 To 20
c(i, j) = New TableCell()
c(i, j).ID = j & ":" & i.ToString
r.Cells.Add(c(i, j))
Next
Table1.Rows.Add(r)
Next
c(3, 2).Text = "this is the text i want in Javascript"
....
My problem is that the Alert gives "undefined".
I can get the 'ID' of each cell, why not the 'text'?
I know there is the property 'ClientID' but it's overruled by the ID i
defined in the code, so that's not the point (i think).
Thanks for help.
Bob