You could try something like:
Dim dgcol As System.Web.UI.W ebControls.Data GridColumn
For Each dgcol In myDG.Columns
If dgcol.HeaderTex t = "column to hide" Then dgcol.Visible = False
Next
in Page_Load after calling myDG.DataBind() . That will work with explicity
defined columns. I'm not sure if that works with auto-generated columns.
Good luck!
-Ryan
"Hanson" <he********@hot mail.com> wrote in message
news:uV******** ******@TK2MSFTN GP10.phx.gbl...
Hi Richard,
Thanks for your reply first. However the problem is I can not access the
autogenerated columns, and then I can not set the column's visible property.
"Richard" <ri*****@nospam .com> wrote in message
news:40******** *************** @newsreader.ewe ka.nl...
Sorry Hanson, i misunderstood the question a bit,
anyway,
use a Visible = False
to make it invisible and not be showed then
"Hanson" <he********@hot mail.com> schreef in bericht
news:un******** *****@TK2MSFTNG P11.phx.gbl...
I have a datagrid control in an aspx page. The datagrid columns will be
dynamically generated according to the pre-page's search condition, I want
to hide some columns in the datagrid. is that anyway to do that?