Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

ObjectList control

Last post 04-22-2007, 11:44 PM by Desmo. 1 replies.
Sort Posts: Previous Next
  •  09-02-2006, 9:48 PM 22323

    ObjectList control

    Is there a way to customize an objectlist control such that each listitem displays in a different color. Customization is dependent on the data so needs to happen in codebehind.  There is no dataitemcreated event exposed? Is the answer to create a custom control?  I have worked with asp.net controls but new to mobile controls.  All I am trying to do is display a dataset in nxn tabular display with each item a different color and also a link, perhaps objectlist is not the answer, but some other control?

  •  04-22-2007, 11:44 PM 29195 in reply to 22323

    Re: ObjectList control

    May be It's too late for answer.

    But recently I 've encountered same problem.

    My work aroud is "use data binding"

    Example)

    In aspx

    <mobile:ObjectList id="ObjectList1" runat="server">
     <DeviceSpecific>
      <Choice Xmlns="http://schemas.microsoft.com/mobile/html32template">
       <ItemTemplate>
       <mobile:Label id="lblCompanyName" runat="server" Text='<%# DataBinder.Eval(((MobileListItem)Container).DataItem,"CompanyName")%>' Visible='<%# IsLabelVisible(((MobileListItem)Container).DataItem) %>'>

    And codebehind ,I defined a method "IsLabelVisible" to switch visibility on data value.

    public bool IsLinkVisible(object obj)
      {
       Job job = (Job) obj;
       if(job.InterviewDate == null || job.InterviewDate == string.Empty)
       {
        return true;
       }
       return false;
      }

     

View as RSS news feed in XML