V
Vagabond Software
I am fairly new to ASP.NET, so bear with me...
I have a Datagrid with a data-bound DropDownList in the TemplateColumn. Here
is the HTML code:
<asp:TemplateColumn HeaderText="Void">
<ItemStyle horizontalalign="Left" wrap="False"></ItemStyle>
<ItemTemplate>
<%#Databinder.Eval(Container.DataItem, "isVoid")%>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddlIsVoid" Runat="server"
CssClass="ddl100"></aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
In Edit Mode, the end-user can select either True or False in the
DropDownList, then save those changes. ALL of that is working correctly.
The trouble comes when I try to deal with the value of that Datagrid column
directly. It appears to always equate to String.Empty. Everytime the
Datagrid is displayed, I go through the rows and change the Row forecolor to
Red where the IsVoid column is True.
Private Sub ColorVoidRows(ByVal dg As DataGrid, ByVal vindex As Integer)
For Each item As DataGridItem In dg.Items
If item.Cells(vindex).Text = "True" Then
item.ForeColor = Color.Red
End If
Next
End Sub
This method works on a number of other Datagrid that can be displayed on the
page, but those Datagrids don't have the templated IsVoid column. So, I
figure it must have something to do with that.
The Cells index is working and I have confirmed that I am looking at the
correct column.
My question is how do I retrieve that value from that TemplateColumn when I
am NOT in Edit Mode?
Any help is greatly appreciated.
carl
I have a Datagrid with a data-bound DropDownList in the TemplateColumn. Here
is the HTML code:
<asp:TemplateColumn HeaderText="Void">
<ItemStyle horizontalalign="Left" wrap="False"></ItemStyle>
<ItemTemplate>
<%#Databinder.Eval(Container.DataItem, "isVoid")%>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="ddlIsVoid" Runat="server"
CssClass="ddl100"></aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
In Edit Mode, the end-user can select either True or False in the
DropDownList, then save those changes. ALL of that is working correctly.
The trouble comes when I try to deal with the value of that Datagrid column
directly. It appears to always equate to String.Empty. Everytime the
Datagrid is displayed, I go through the rows and change the Row forecolor to
Red where the IsVoid column is True.
Private Sub ColorVoidRows(ByVal dg As DataGrid, ByVal vindex As Integer)
For Each item As DataGridItem In dg.Items
If item.Cells(vindex).Text = "True" Then
item.ForeColor = Color.Red
End If
Next
End Sub
This method works on a number of other Datagrid that can be displayed on the
page, but those Datagrids don't have the templated IsVoid column. So, I
figure it must have something to do with that.
The Cells index is working and I have confirmed that I am looking at the
correct column.
My question is how do I retrieve that value from that TemplateColumn when I
am NOT in Edit Mode?
Any help is greatly appreciated.
carl