About DataGrid Question

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi there,

I use datagrid to display my web page data and the first and the second
column's visible property is false.
How should I do if I want to get the first and second column's data ?
I use the following method, but failed...

I.
CType(e.Item.Cells(0).Controls(0), TextBox).Text

II.
e.Item.Cells(0).Text
 
Hi Paul,

Tis is a code I', using, I have the first column invisible as it contain
the IDof the strong typed collection's item I'm binding to.
This comes from a event handler ( Edit )

protected void ActionEditCommand(object sender, DataGridCommandEventArgs e)

{

int ID = Convert.ToInt32(((Label)e.Item.FindControl("ActionID")).Text)

}

I used a Label in the column to keep the ID value:
<asp:templatecolumn Visible="False">
<itemtemplate>
<asp:Label CssClass="text" Visible="False" id="ActionID"
Runat="server" Text='<%# ((CtpAction)Container.DataItem).ID.ToString()%>'>
</asp:Label>
</itemtemplate>
</asp:templatecolumn>


Hope this help,
 
Back
Top