locked
How to change ObjectList items, ForeColor, Font ..... ? RRS feed

  • Question

  • User2041710445 posted
    Dear All, How can I change the listed items forecolor, font, and so on generated by using an "ObjectList" in VB.NET ? What I already tried ... During "onItemDataBind" <Mobile:ObjectList id="ObjectList1" runat="server" onItemDatabind="On_ItemDataBind"> <Field title="Name" name="artcod" datafield="artcod"></Field> </Mobile:ObjectList> Sub On_ItemDataBind(ByVal sender As Object, ByVal e As ObjectListDataBindEventArgs) If e.ListItem.Item("artcod") = "0" Then e.ListItem.ForeColor = System.Drawing.Color.FromName("#FF0000") '--red color '--- or e.ListItem.ForeColor = System.Drawing.Color.Red End if End sub Above does'not work, without any error! This works, for the whole objectlist. ObjectList1.ForeColor = System.Drawing.Color.FromName("#FF0000") I need only to change one item. If someone knows and can help me, thanks in advance, AnCo
    Tuesday, September 30, 2003 7:19 AM

All replies

  • User851968706 posted
    Did you you resolve it? I am in the same trouble.
    Wednesday, July 14, 2004 5:21 AM
  • User-1483006097 posted
    Seriously, I'm having the same problem too.  I'm using similar code to what AnCo wrote - and it looks pretty straight forward.  Does anyone have any idea why this doesn't work?  Any suggestions to a work around?  Thanks.
    Monday, October 10, 2005 5:31 PM
  • User2072560617 posted
    This is what I do:

    if(this.txtCutOffDate.Text == "")
                                    {
                                        this.txtCutOffDate.BackColor = ColorTranslator.FromHtml("#FFFFCC");
                                        this.lblCutOffDate.ForeColor = ColorTranslator.FromHtml("#FF0000");
                                        this.lblTitle.ForeColor = ColorTranslator.FromHtml("#FF0000");
                                        return false;
                                    }
                                    else
                                    {
                                        this.txtCutOffDate.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                                        this.lblCutOffDate.ForeColor= ColorTranslator.FromHtml("#000000");
                                        this.lblTitle.ForeColor = ColorTranslator.FromHtml("#000000");
                                        return true;
                                    }



    Wednesday, October 12, 2005 4:16 PM