Hi,

Label label = new Label("fName",  myVO.getName()); // (or better use new
PropertyModel<String>(user, "name") )
label.setVisible(myVO.getName()!=null);
add(label );

Also, the fName markup id seems to be missing in your html (also the
"message" markup id in "test")
<div wicket:id="test1">
    <div wicket:id="fName">

    </div>
</div>

<div wicket:id="test1">
    <div wicket:id="message">

    </div>
</div>

Hope this helps,
Sebastien.

On Fri, Aug 10, 2012 at 12:49 AM, wicket user <samd...@live.com> wrote:

> Hi,
>  I tried this .
>
> public class MyContainer extends WebMarkupContainer{
> public MyContainer(String id, MyVO myVO) {
>                 super(id);
> if(myVO.getName()!=null)
>   add( new Label("fName",  myVO.getName()));
> else
>  add( new Label("fName", " ")).setVisible(false);
> }
> public MyContainer(String id){
> super(id);
>  add(new Label("message", "Testing Label");
> }
>
> }
>
>
> Calling from my Class
>
> add( new MyContainer("test"));
> add( new MyContainer("test1", VO);
>
>
> In html
>
> <div wicket:id="test">
>
> </div>
>
> <div wicket:id="test1">
>
> </div>
>
>
>
>
> But the problem is I am getting the first markup which is "test" and not
> the
> "test1" even though the getName is not null.
>
> PLease advise
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651112.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to