This is a migrated thread and some comments may be shown as answers.

Images in appointment subject

1 Answer 60 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 26 Mar 2010, 05:23 PM

Hi All,

I'd like to conditionally have a couple of images shown along with the subject of an appointment.  To that end I tried putting the following code into the subject from the AppointmentDataBound event. 

            Dim subject As String = e.Appointment.Subject  
            subject += " - " & dataRowView.Item("Title").ToString()  
 
            Dim Status As Integer = 0 
            Status = CInt(dataRowView.Item("Status"))  
            Dim errorImages As String = "" 
            If Status = 1 OrElse Status = 3 Then  
                errorImages = "<img src=""/images/icons/16/not_ok.png"" border=""0"" />" 
            End If  
            If Status = 2 OrElse Status = 3 Then  
                errorImages += "<img src=""/images/icons/16/not_ok_orange.png"" border=""0"" />"  
            End If  
 
            e.Appointment.Subject = errorImages & subject 

When this executes it works but the <img... is rendered as text in the appointment.  Is there a way to use this method to get the images rendered? 

I could use a AppointmentTemplate but given that the Status flag can affect two images I'm not sure how I could do it.  Any pointers?

Regards,

Jon

1 Answer, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 26 Mar 2010, 05:25 PM
never mind, I did it like this:

<AppointmentTemplate>   
   <asp:Image ID="Image1" runat="server" ImageUrl='/images/icons/16/not_ok.png' Visible='<%# CBool(Iif(Eval("Status")="1" or Eval("Status")="3",True,False)) %>' />   
   <asp:Image ID="Image2" runat="server" ImageUrl='/images/icons/16/not_ok_orange.png' Visible='<%# CBool(Iif(Eval("Status")="2" or Eval("Status")="3",True,False)) %>' />   
   <asp:Literal ID="AppointmentSubject" runat="server" Text='<%# Eval("Subject") %>'></asp:Literal>   
</AppointmentTemplate>  
Tags
Scheduler
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Share this question
or