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

HTML Encoding

5 Answers 88 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 1
Andy Green asked on 03 Aug 2009, 08:23 AM
Hi

My Schedule is currently showing data from a database in the appointment section. This data contains HTML, but the tags are being shown and are not being rendered as HTML. Is there a HTMLEncode equivalent like bound colunms on Rad / data grids.

This is what is displayed:QEH <br/> BWH <br/> DCC
This is the view source:QEH &lt;br/&gt; BWH &lt;br/&gt; DCC
This is what I want:
QEH
BWH
DCC

Or is there another way to achieve this.

Andy

5 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 03 Aug 2009, 11:29 AM
Hi Andy,

You can easily workaround this problem using AppontmentTemplate:

 <AppointmentTemplate> 
        <asp:Panel ID="Panel1" runat="server">  
        </asp:Panel> 
    </AppointmentTemplate> 

protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)  
    {  
        string[] subjectArray = Regex.Split(e.Appointment.Subject, "</br>");  
        Panel subjectPanel = e.Container.FindControl("Panel1"as Panel;         
          
        foreach (string subPart in subjectArray)  
        {  
            Literal subjectLine = new Literal();  
            subjectLine.Text = subPart + "</br>";  
            subjectPanel.Controls.Add(subjectLine);             
        }  
    } 


Greetings,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Peter
Telerik team
answered on 03 Aug 2009, 11:55 AM
Hi again Andy,

I don't know why I went this way for a workaround, when actually there is a much simpler solution:

<AppointmentTemplate> 
        <%# Eval("Subject") %> 
    </AppointmentTemplate> 

Sorry for the unnecessarily complicated previous solution.


Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andy Green
Top achievements
Rank 1
answered on 02 Sep 2009, 09:58 AM
Hi Team

Things have change with this, and the scheduler now sits inside a repeater control. But......

Neither proposed option works,
With the first option it fails because the with events refers to the control that is wrapped inside the repeater and it cant find it.
'Handles clause requires a WithEvents variable defined in the containing type or one of its base types'

The second method - The data I wish to show is created for the RadScheduler, ie the repeater has a datafield value for week number, this week number is passsed into the itemcreated to get the appointment data for the scheuler, so this wont work either.

How can I achieve this with my current set up.

Andy
0
Peter
Telerik team
answered on 03 Sep 2009, 02:04 PM
Hello Andy,

This is a VB.NET problem. The solution which I found in the forums is to set the event handler declaratively:

* * *  
 
<telerik:RadScheduler runat="server" ID="RadScheduler1" OnAppointmentCreated="RadScheduler1_AppointmentCreated">  
 
* * * 

and to remove "Handles RadScheduler1.AppointmentCreated" from the event handler:

Protected Sub RadScheduler1_AppointmentCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.AppointmentCreatedEventArgs)  
 
End Sub 


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andy Green
Top achievements
Rank 1
answered on 03 Sep 2009, 02:13 PM
Brilliant - thank you.

BTW - I do search the forums before I post, but I guess it's knowing what to search for.

Andy
Tags
Scheduler
Asked by
Andy Green
Top achievements
Rank 1
Answers by
Peter
Telerik team
Andy Green
Top achievements
Rank 1
Share this question
or