how to check the value of a field
Hi,
The aspx file contains a datasource and a gridview.
The (only) field is a boolean type (true/false).
Now, when the value of the field is 'true' something must happen (the backgroundcolor must be red).
So i used the server-event 'GridView1_RowCreated' but how can i check the value of the field on each row in the code-behind?
I tried this code below, but it doesn't work ...
Thanks
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=c:\mydb.mdb"
ProviderName="System.Data.OleDb" SelectCommand="SELECT field1 from
mytable"></asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
<Columns><asp:BoundField DataField="myfield" /> </Columns>
</asp:GridView>
The code-behind:
Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
Dim a As DataControlField
a = GridView1.Columns(0)
...
End Sub
(variable 'a' contains the name of the field but there is nothing i can put after 'Columns(0).' , like "value" or something ...)
|