I
Ing. Rajesh Kumar
Hi everybody
I have a problem reading the content of a cell. When i use AutogenerateColumns = True or when i use
<asp:BoundColumn DataField="COLUMN1" HeaderText="COLUMN1"/> then i can simply read the content of a cell in the OnItemDataBound method using the following code :
For j = 0 To DT.Columns.Count - 1
If e.Item.Cells(j).Text = "something" Then Do Something
Next
Now i changed some columns to template columns as follows :
<asp:TemplateColumn HeaderText="COLUMN1">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem, "COLUMN1") %></ItemTemplate>
</asp:TemplateColumn>
and now i am unable to read the content of the Template Columns. It still reads BoundColumn's content. Last four hours i spend playing with it and still cannot read the value.
Just for testing i used the "nothing" comand as follows:
If e.Item.Cells(j).Text = "" Then Do Something
and it works. So it means that there is no value in the template column OnItemDataBound ?
Then how should i read the content of a TemplateColumn ?
Thanks in advance
Raja
I have a problem reading the content of a cell. When i use AutogenerateColumns = True or when i use
<asp:BoundColumn DataField="COLUMN1" HeaderText="COLUMN1"/> then i can simply read the content of a cell in the OnItemDataBound method using the following code :
For j = 0 To DT.Columns.Count - 1
If e.Item.Cells(j).Text = "something" Then Do Something
Next
Now i changed some columns to template columns as follows :
<asp:TemplateColumn HeaderText="COLUMN1">
<ItemTemplate><%# DataBinder.Eval(Container.DataItem, "COLUMN1") %></ItemTemplate>
</asp:TemplateColumn>
and now i am unable to read the content of the Template Columns. It still reads BoundColumn's content. Last four hours i spend playing with it and still cannot read the value.
Just for testing i used the "nothing" comand as follows:
If e.Item.Cells(j).Text = "" Then Do Something
and it works. So it means that there is no value in the template column OnItemDataBound ?
Then how should i read the content of a TemplateColumn ?
Thanks in advance
Raja