I did find that I can do the <div id=name visible=false runat="server">. I
needed to do this instead of making each object invisible as the datalist
control has html table/tr/td code in it that would still be visible.
The problem is that if I use the div and make it invisible, I seem to lose
the other object forever. I tried to make the div visible (which works
fine), but the objects (grid, labels etc) are not there.
Here is the control tree from my trace.warn:
************************************************** **
DataList1System.Web.UI.WebControls.DataList113976
DataList1:_ctl0System.Web.UI.WebControls.DataListI tem290
DataList1:_ctl0:_ctl0System.Web.UI.LiteralControl1 00
DataList1:_ctl0:dataListItemDivSystem.Web.UI.HtmlC ontrols.HtmlGenericControl032
DataList1:_ctl0:_ctl1System.Web.UI.LiteralControl0 0
DataList1:_ctl0:ExpandButtonSystem.Web.UI.WebContr ols.ImageButton00
DataList1:_ctl0:_ctl2System.Web.UI.LiteralControl0 0
DataList1:_ctl0:CollapseButtonSystem.Web.UI.WebCon trols.ImageButton00
DataList1:_ctl0:_ctl3System.Web.UI.LiteralControl0 0
DataList1:_ctl0:PositionIDSystem.Web.UI.WebControl s.Label032
DataList1:_ctl0:_ctl4System.Web.UI.LiteralControl0 0
DataList1:_ctl0:QuestionUniqueSystem.Web.UI.WebCon trols.Label028
DataList1:_ctl0:_ctl5System.Web.UI.LiteralControl0 0
DataList1:_ctl0:QuestionTypeSystem.Web.UI.WebContr ols.Label032
DataList1:_ctl0:_ctl6System.Web.UI.LiteralControl0 0
DataList1:_ctl0:QuestionSystem.Web.UI.WebControls. Label084
DataList1:_ctl0:_ctl7System.Web.UI.LiteralControl0 0
DataList1:_ctl0:DataGrid1System.Web.UI.WebControls .DataGrid0136
DataList1:_ctl0:dataGridBrSystem.Web.UI.HtmlContro ls.HtmlGenericControl00
DataList1:_ctl0:_ctl8System.Web.UI.LiteralControl0 0
DataList1:_ctl0:submitQuestionSystem.Web.UI.WebCon trols.Button00
DataList1:_ctl0:_ctl9System.Web.UI.LiteralControl0 0
DataList1:_ctl0:_ctl10System.Web.UI.LiteralControl 190
DataList1:_ctl1System.Web.UI.WebControls.DataListI tem190
DataList1:_ctl1:_ctl1System.Web.UI.LiteralControl1 00
DataList1:_ctl1:_ctl0System.Web.UI.HtmlControls.Ht mlGenericControl00
DataList1:_ctl1:_ctl2System.Web.UI.LiteralControl9 0
DataList1:_ctl2System.Web.UI.WebControls.DataListI tem290
DataList1:_ctl2:_ctl0System.Web.UI.LiteralControl1 00
DataList1:_ctl2:dataListItemDivSystem.Web.UI.HtmlC ontrols.HtmlGenericControl032
DataList1:_ctl2:_ctl1System.Web.UI.LiteralControl0 0
DataList1:_ctl2:ExpandButtonSystem.Web.UI.WebContr ols.ImageButton00
DataList1:_ctl2:_ctl2System.Web.UI.LiteralControl0 0
DataList1:_ctl2:CollapseButtonSystem.Web.UI.WebCon trols.ImageButton00
DataList1:_ctl2:_ctl3System.Web.UI.LiteralControl0 0
DataList1:_ctl2:PositionIDSystem.Web.UI.WebControl s.Label032
DataList1:_ctl2:_ctl4System.Web.UI.LiteralControl0 0
DataList1:_ctl2:QuestionUniqueSystem.Web.UI.WebCon trols.Label028
DataList1:_ctl2:_ctl5System.Web.UI.LiteralControl0 0
DataList1:_ctl2:QuestionTypeSystem.Web.UI.WebContr ols.Label032
DataList1:_ctl2:_ctl6System.Web.UI.LiteralControl0 0
DataList1:_ctl2:QuestionSystem.Web.UI.WebControls. Label060
DataList1:_ctl2:_ctl7System.Web.UI.LiteralControl0 0
DataList1:_ctl2:DataGrid1System.Web.UI.WebControls .DataGrid0136
DataList1:_ctl2:dataGridBrSystem.Web.UI.HtmlContro ls.HtmlGenericControl00
DataList1:_ctl2:_ctl8System.Web.UI.LiteralControl0 0
DataList1:_ctl2:submitQuestionSystem.Web.UI.WebCon trols.Button00
DataList1:_ctl2:_ctl9System.Web.UI.LiteralControl0 0
DataList1:_ctl2:_ctl10System.Web.UI.LiteralControl 190
DataList1:_ctl3System.Web.UI.WebControls.DataListI tem190
DataList1:_ctl3:_ctl1System.Web.UI.LiteralControl1 00
DataList1:_ctl3:_ctl0System.Web.UI.HtmlControls.Ht mlGenericControl00
DataList1:_ctl3:_ctl2System.Web.UI.LiteralControl9 0
************************************************** ********************************
Every other datalistitems show the controls and the other only show 3
controls.(I think because of the AlternateRow).
This is after I set all the div to visible=true.
So obviously this is not going to work.
It would have been so easy had MS property worked correctly.
Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Jc Morin" <mi****************@jcmorin.net> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl... Hi Tom,
The visible property inherits from the Control object, this property is
usually used to hide completely a control.
Setting the property to every items seems logical to me also to hide/show
them but It seems that your right, it doesn't work...
However I found something that may interest you.
I've try this in the ItemDataBound methods:
e.Item.Parent.Visible = False
And the visible property seems to works.
Lets me know if that solve your problem.
Not sure how to make this work.
The databound event only happens once per row as the data comes in.
In my case,
I want to be able make the datalistitem visible and not visible depending
on the user. All the data is there already.
I tried to put a <div id="dataitem" runat="server"> around the data inside
the ItemTemplate, but got a compiler error trying that.
The only way I have been able to figure out how to do it is to make each
object in the datalist "not visible" and then make the ones in the
datalist I am dealing with visible (and of course the list that was
visible needs to be made invisible).
Would have been easier and cleaner to be able to use the visible field of
the datalistitem as MS documentation says you can.
Thanks,
Tom
--------------------------
Jean-Claude Morin, MCP
Software Developer
2k1Soft/kCentric, Canada
"tshad" <ts**********@ftsolutions.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl... I am trying to hide all my datalistitems, which contain labels,
textboxes
a datagrid, etc. I want to show each datalist item one at a time on the
page as the user pages through it.
I tried:
for each oItem as DataListItem in DataList1.Items
oItem.Visible = false
And that doesn't seem to work.
I can set the whole datalist.visible to false and it hides it fine.
Why doesn't the Datalistitem.visible = false work? It is supposed to be
a
property of the datalistitem.
Thanks,
Tom