Ask a Question related to ASP.NET General, Design and Development.
-
John #1
Hiding all controls contained within a placeholder
Hi all,
How do I iterate through a specific placeholder and remove or hide all
controls contained within that placeholder?
Regards
John.
John Guest
-
ViewState of Contained Controls?
I've built my tab control, and it works great. Except for one problem. Any controls which are contained in any of the tabs lose state. The tab... -
Accessing Controls contained in another Control from ASPX Page
Hi All! Is there any ways to get access to the controls contained in another user controls from an ASP.NET page? For example I have... -... -
Build control in a placeholder or like a placeholder
Hi. I create a new custom control and it works fine. But now, I need to put it in any place on the page, like the placehold control do. Someone... -
Baseline Shift Controls Need to Stop Hiding
Nehmo Richiebee Nehmo Just don't let it happen again.I might not be so charitable next time. -
Contained Controls not hiding as expected
Hi I have a hidden Panel (DIV, style.visibility='hidden') control containing a hidden TextBox. If I make the Panel visible, then make the... -
John #2
Re: Hiding all controls contained within a placeholder
Thanks Karl,
I'll give the loop through a try. The reason I don't want to set the
visibility to false is because I could have one of quite a few user controls
loaded into the placeholder and if I have say, 5 user controls loaded, the
load event will fire in each user control contained within the placeholder
which is unnecessary.
Incidentally, how does a user control differentiate between the first time
it has been loaded into a page and subsequent times?
Regards
John.
"Karl Seguin" <kseguin##crea.ca> wrote in message
news:OQHv0PJQDHA.2676@TK2MSFTNGP10.phx.gbl...> Why don't you just set the visibility of the placeholder to false?
>
> YourPlaceHolder.Visible = false
>
> If you need to loop through this child controls, try this:
>
> Public Sub HideControls(ByVal ParentCntrl As System.Web.UI.Control)
> Dim ChildCntrl As System.Web.UI.Control
> For each ChildCntrl in ParentCntr.Controls
> ChildCntrl.visible = false
> If ChildCntrl.HasControls = True Then
> HideControls(ChildCntrl)
> End If
> Next
> End Sub
>
> if you actually want to loop through the controls,
> "John" <a@b.com> wrote in message
> news:Obts67HQDHA.1720@TK2MSFTNGP11.phx.gbl...>> > Hi all,
> >
> > How do I iterate through a specific placeholder and remove or hide all
> > controls contained within that placeholder?
> >
> > Regards
> > John.
> >
> >
>
John Guest
-
William F. Robertson, Jr. #3
Re: Hiding all controls contained within a placeholder
Set a viewstate for the control that tells whether is has been posted back
on.
in your user control:
void Page_Load(...)
{
if ( ViewState["IsUCPostback"] == null )
{
ViewState["IsUCPostback"] = true;
//data binding code
}
}
HTH,
bill
"John" <a@b.com> wrote in message
news:uTlumaJQDHA.2052@TK2MSFTNGP11.phx.gbl...controls> Thanks Karl,
>
> I'll give the loop through a try. The reason I don't want to set the
> visibility to false is because I could have one of quite a few user> loaded into the placeholder and if I have say, 5 user controls loaded, the
> load event will fire in each user control contained within the placeholder
> which is unnecessary.
>
> Incidentally, how does a user control differentiate between the first time
> it has been loaded into a page and subsequent times?
>
> Regards
> John.
>
>
> "Karl Seguin" <kseguin##crea.ca> wrote in message
> news:OQHv0PJQDHA.2676@TK2MSFTNGP10.phx.gbl...>> > Why don't you just set the visibility of the placeholder to false?
> >
> > YourPlaceHolder.Visible = false
> >
> > If you need to loop through this child controls, try this:
> >
> > Public Sub HideControls(ByVal ParentCntrl As System.Web.UI.Control)
> > Dim ChildCntrl As System.Web.UI.Control
> > For each ChildCntrl in ParentCntr.Controls
> > ChildCntrl.visible = false
> > If ChildCntrl.HasControls = True Then
> > HideControls(ChildCntrl)
> > End If
> > Next
> > End Sub
> >
> > if you actually want to loop through the controls,
> > "John" <a@b.com> wrote in message
> > news:Obts67HQDHA.1720@TK2MSFTNGP11.phx.gbl...> >> > > Hi all,
> > >
> > > How do I iterate through a specific placeholder and remove or hide all
> > > controls contained within that placeholder?
> > >
> > > Regards
> > > John.
> > >
> > >
> >
>
William F. Robertson, Jr. Guest



Reply With Quote

