Hiding a LinkButton in DataList

Posted by sanfra1983 on Stack Overflow See other posts from Stack Overflow or by sanfra1983
Published on 2010-05-19T11:59:26Z Indexed on 2010/05/19 12:10 UTC
Read the original article Hit count: 252

Filed under:
|

Hi someone can tell me how to hide a LinkButton inside a DataList?

I've tried to do this but I do not work:

 protected void Page_PreRender(object sender, EventArgs e)
    {


        foreach (var item in listanews)
        {
            DataList container = dlgestionenews;
            if (string.IsNullOrEmpty(item.IdNews))
            {

                DataListItem itemdatalist = null;


                foreach (DataListItem itemdl in container.Items)
                {

                    foreach (Control control in itemdatalist.Controls)
                    {

                        if (control.GetType().FullName == "LinkButton")
                        {
                            ((LinkButton)control).Visible = false;

                        }

                    }
                }

            }
        }
    }

Thanks!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-3.5