Good day guys!
I'm using c# as my code-behind (ascx.cs) and my environment is Visual Studio 2008.
the issue is, i can't get to access labels inside the gridview..
my gridview definition is:
<============== =============== =============== =============== =
=============== =============== =============== =============== >
::wherein the datasourceid is an sql object..
in my RowDataBound(ob ject sender, GridViewRowEven tArgs e) method, I already tried using:
<============== =============== =============== =============== =
((Label)e.Row.C ells[0].FindControl("m essage")).Text
((Label)e.Row[e.Row.RowIndex].FindControl("r egUser")).Text
=============== =============== =============== =============== >
but what i get is all NULL.
i'm really just a beginner in c# and so far i'm doing gud except for this issue.
please help!
I'm using c# as my code-behind (ascx.cs) and my environment is Visual Studio 2008.
the issue is, i can't get to access labels inside the gridview..
my gridview definition is:
<============== =============== =============== =============== =
Code:
<asp:GridView ID="commentsGrid" runat="server" DataSourceID="sqlDS" Width="810px" AutoGenerateColumns="False" Font-Names="Tahoma" Font-Size="X-Small" BorderStyle="None" GridLines="None" ShowHeader=False onrowdatabound="commentsGrid_RowDataBound" Visible="False" > <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label ID="user" runat="server" Text=<%# Eval("User") %>> </asp:Label> <br /> <asp:Label ID="regDate" runat="server" Text=<%# String.Format("{0:dd-MMMM-yy}", Eval("REGDATE"))%> > </asp:Label> <br /> <asp:Label ID="regTime" runat="server" Text=<%# String.Format("{0:HH:mm:ss}", Eval("REGTIME"))%>> </asp:Label> <br /> <asp:Label ID="regUser" runat="server" Text=<%# Eval("REGISTER_USER")%> Visible=true> </asp:Label> </ItemTemplate> <ControlStyle CssClass="styleu6"></ControlStyle> </asp:TemplateField> <asp:BoundField DataField="MESSAGE" SortExpression="MESSAGE" ControlStyle-CssClass="styleu7" ShowHeader="False"> <ControlStyle CssClass="styleu7"></ControlStyle> </asp:BoundField> <asp:CommandField ButtonType="Button" ShowDeleteButton="True" ShowEditButton="True" /> </Columns> </asp:GridView>
::wherein the datasourceid is an sql object..
in my RowDataBound(ob ject sender, GridViewRowEven tArgs e) method, I already tried using:
<============== =============== =============== =============== =
((Label)e.Row.C ells[0].FindControl("m essage")).Text
((Label)e.Row[e.Row.RowIndex].FindControl("r egUser")).Text
=============== =============== =============== =============== >
but what i get is all NULL.
i'm really just a beginner in c# and so far i'm doing gud except for this issue.
please help!