G
Guest
I have a table within a cell of a datagrid. I am doing updates without
postback to the server using Javascript. I have everything working, except
referencing a table within the datagrid cell.
Here is my datagrid code for the cell;
<asp:TemplateColumn HeaderText="3Fields" ItemStyle-Font-Size="8"
SortExpression="Field1 ASC" ItemStyle-Font-Name="Verdana">
<ItemTemplate>
<table border="0">
<tr>
<td id="Field1"><font size="0" face="Verdana"><b><%#
DataBinder.Eval(Container.DataItem, "Field1") %></b></font>
</td>
</tr>
<tr>
<td><font size="0" face="Verdana"><b><%# DataBinder.Eval(Container.DataItem,
"Field2") %></b></font>
</td>
</tr>
<tr>
<td><font size="0" face="Verdana"><b><%# DataBinder.Eval(Container.DataItem,
"Field3") %></b></font>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
My javascript for referencing the data looks like this;
function UpdateComments(nField1,nField2)
{
for(counter=1;counter<parseInt(NumberOfRecords.outerText)+1;counter++)
{
alert(MyDataGrid.firstChild.childNodes(counter).childNodes(2).field1.innerText)
if (MyDataGrid.firstChild.childNodes(counter).childNodes(2).innerText ==
nfield1) and
(MyDataGrid.firstChild.childNodes(counter).childNodes(2).innerText == nfield2)
{
MyDataGrid.firstChild.childNodes(counter).childNodes(9).innerText= "Comments
Entered"
}
}
}
I have added an alert to see the value of what I am trying to compare to.
The field1.innerText comes up as an error with null or doesn't exist. If I
just reference the innertext without the project ID, I get all three fields.
I am just trying to reference the first.
How can I reference individual cells within a datagrid cell?
Thank you,
Lyners
postback to the server using Javascript. I have everything working, except
referencing a table within the datagrid cell.
Here is my datagrid code for the cell;
<asp:TemplateColumn HeaderText="3Fields" ItemStyle-Font-Size="8"
SortExpression="Field1 ASC" ItemStyle-Font-Name="Verdana">
<ItemTemplate>
<table border="0">
<tr>
<td id="Field1"><font size="0" face="Verdana"><b><%#
DataBinder.Eval(Container.DataItem, "Field1") %></b></font>
</td>
</tr>
<tr>
<td><font size="0" face="Verdana"><b><%# DataBinder.Eval(Container.DataItem,
"Field2") %></b></font>
</td>
</tr>
<tr>
<td><font size="0" face="Verdana"><b><%# DataBinder.Eval(Container.DataItem,
"Field3") %></b></font>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
My javascript for referencing the data looks like this;
function UpdateComments(nField1,nField2)
{
for(counter=1;counter<parseInt(NumberOfRecords.outerText)+1;counter++)
{
alert(MyDataGrid.firstChild.childNodes(counter).childNodes(2).field1.innerText)
if (MyDataGrid.firstChild.childNodes(counter).childNodes(2).innerText ==
nfield1) and
(MyDataGrid.firstChild.childNodes(counter).childNodes(2).innerText == nfield2)
{
MyDataGrid.firstChild.childNodes(counter).childNodes(9).innerText= "Comments
Entered"
}
}
}
I have added an alert to see the value of what I am trying to compare to.
The field1.innerText comes up as an error with null or doesn't exist. If I
just reference the innertext without the project ID, I get all three fields.
I am just trying to reference the first.
How can I reference individual cells within a datagrid cell?
Thank you,
Lyners