P
phil
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 (e.g.
Response.Write("this is true") ).
So i used the server-event 'GridView1_RowCreated' but how can i check the
value of the field on each row?
I tried this code below, but it doesn't work ...
Thanks
Phil
<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)
' This contains the name of the field but there is nothing i can put after
'Columns(0).' , like "value" or something ...
End Sub
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 (e.g.
Response.Write("this is true") ).
So i used the server-event 'GridView1_RowCreated' but how can i check the
value of the field on each row?
I tried this code below, but it doesn't work ...
Thanks
Phil
<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)
' This contains the name of the field but there is nothing i can put after
'Columns(0).' , like "value" or something ...
End Sub