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

[Solved] adding more fields to view

16 Answers 210 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
mike john
Top achievements
Rank 1
mike john asked on 07 Feb 2010, 10:07 PM
Hi I have been playing around with the Scheduler its a pretty cool control I would like to be able to display more than just the title and description when you select an appointment is it possible to include an additional filed from te database that would show in the appointment window?

thks

M

16 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 09 Feb 2010, 02:23 PM
You should be able to do this quite easily. I think if you look over the Custom Resources and Attributes documentation article you can get some further insight on how to accomplish this.
0
Peter
Telerik team
answered on 09 Feb 2010, 02:56 PM
Hello Mike,

You can also review the Advanced Templates demo:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx


Best wishes,
Peter
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
mike john
Top achievements
Rank 1
answered on 10 Feb 2010, 07:41 PM
Thank you both for the reply I now have a drop down box, however I am trying to display a url (idealy in a text box so the user could dl a file stored on the server :-) )

is there a way to change the type of additional recource types field or did I miss somthing

thanks

M
0
mike john
Top achievements
Rank 1
answered on 10 Feb 2010, 08:05 PM
I am now getting an error when you select an appointment it shows the appointment window I have a description field which has <p> to format the text view however if I select close using the X button I get

Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (RadScheduler1_Form_Description_text="<p>
Praesent ut jus...").

if I remove the <p> its fine obviously this is not very good for a normal user why is it giving an error when it put the <p> in the first place ???



0
Peter
Telerik team
answered on 12 Feb 2010, 05:14 PM
Hi Mike,

You might find useful the Using Templates demo. You can use a custom attribute to store the url for the appointment.

All the best,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mike john
Top achievements
Rank 1
answered on 17 Feb 2010, 11:28 AM
Thanks for the reply I have managed to show a text box that displays the url of the file (when it is stored in the database its gets stored as http://localhost/(folder)/file.zip ) is it possible to make the contents of that text box a clickable link

thanks

Mike

0
Peter
Telerik team
answered on 19 Feb 2010, 01:31 PM
Hello mike,

It might be better to use a link directly, instead of a textbox. For example:

<a href='<%# Eval("UrlPath") %>'>uploaded file</a>, where UrlPath is your custom attribute.

Let me know if there is a reason why you cannot use this approach.


Kind regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mike john
Top achievements
Rank 1
answered on 19 Feb 2010, 06:17 PM
Hi thanks for your reply I currently have

   <telerik:ResourceStyleMapping ApplyCssClass="" Key="fileUpload" Text=""   
                    Type="http://" /> 
            </ResourceStyles> 
            <AppointmentContextMenus> 
                <telerik:RadSchedulerContextMenu ID="RadSchedulerContextMenu1" runat="server"   
                    DataMember="DefaultView" DataNavigateUrlField="fileUpload" DataTextFormatString="url" 
                    DataSourceID="SqlDataSource1" DataTextField="fileUpload"   
                    DataValueField="fileUpload" Height="10px" Width="100%">  
                </telerik:RadSchedulerContextMenu> 
            </AppointmentContextMenus> 
            <AdvancedForm EnableCustomAttributeEditing="True" /> 
        </telerik:RadScheduler> 

Where would I add your referance so the fileUpload becomes a link

thanks

M

0
Peter
Telerik team
answered on 23 Feb 2010, 11:41 AM
Hello Mike,

You can add the link in the advanced form templates or the appointment template:

<telerik:RadScheduler ID="RadScheduler1" runat="server">
       <AdvancedEditTemplate>
           ***
       </AdvancedEditTemplate>
       <AdvancedInsertTemplate>
           ***
       </AdvancedInsertTemplate>
       <AppointmentTemplate>
           ***
       </AppointmentTemplate>
   </telerik:RadScheduler>


Greetings,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mike john
Top achievements
Rank 1
answered on 23 Feb 2010, 07:27 PM
Thanks for the reply please see this doc I have added screen shots so you can see the outputs

http://students.comp.glam.ac.uk/05020441/code.doc

thanks

Mike
0
mike john
Top achievements
Rank 1
answered on 27 Feb 2010, 03:23 PM
Anyone able to point me in the right place or explain why the correct url is not showing
0
Peter
Telerik team
answered on 01 Mar 2010, 02:28 PM
Hi mike,

It looks like you are not using the AdvancedEditTemplate or AdvancedInsertTemplate. If you just need to add the download file link, you don't really have to use the advanced templates, because there is an easier way to achieve this by handling FormCreated as follows:

protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
        {
            Panel submitArea = e.Container.FindControl("ButtonsPanel").Parent as Panel;
            HyperLink link1 = new HyperLink();
            link1.Text= "upload file";
            link1.NavigateUrl = e.Appointment.Attributes["fileUpload"];
            submitArea.Controls.Add(link1);
        }
    }

Please, try the above code and let us know how it goes.


Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mike john
Top achievements
Rank 1
answered on 01 Mar 2010, 03:15 PM
Hi thanks for the reply I converted your code to vb so I have the following

Imports Telerik.Web.UI  
 
Partial Class users_Default  
    Inherits System.Web.UI.Page  
    Protected Sub RadScheduler1_FormCreated(ByVal sender As ObjectByVal e As SchedulerFormCreatedEventArgs)  
        If e.Container.Mode = SchedulerFormMode.AdvancedEdit OrElse OrElse e.Container.Mode = SchedulerFormMode.AdvancedInsert Then 
            Dim submitArea As Panel = TryCast(e.Container.FindControl("ButtonsPanel").Parent, Panel)  
            Dim link1 As New HyperLink()  
            link1.Text = "upload file" 
            link1.NavigateUrl = e.Appointment.Attributes("fileUpload")  
            submitArea.Controls.Add(link1)  
        End If 
    End Sub 
End Class 

when I select a date from the calander it opens the edit event (appointment) window I can see all the details but no button or link for the file dl

see attached



0
Peter
Telerik team
answered on 04 Mar 2010, 12:43 PM
Hi mike,

I think the event is not wired properly, so FormCreated is not handled at all. Can you attach to this event from the designer and paste the code in the event handler. Usually, the event handler will be auto generated and wired with 'Handles RadScheduler1.FormCreated '. For example:

Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated
  End Sub


All the best,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
mike john
Top achievements
Rank 1
answered on 07 Mar 2010, 11:18 AM
Hi thanks for the reply I have included both files that I am using

regards

Mike

<%@ Page Language="VB" validateRequest=false AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="users_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
    <form id="form1" runat="server">  
 
<html xmlns="http://www.w3.org/1999/xhtml">  
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 <link href="../b_style.css" rel="stylesheet" type="text/css" /> 
<head id="Head1" runat="server">  
<title>User Home</title> 
 
 </head>   
    
<body> 
<div id="b_container">  
 
  <div class="b_content_top">  
    </div> 
  <div id="b_content">  
    <div class="banner">  
    <div class="logo">  
      
        <asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
      
    </div> 
    </div> 
    <div id="b_menu">  
   
      <div class="menuright"></div> 
        
      <div class="menuleft"></div> 
     <ul> 
         <li><a href="Default.aspx" class="current">Home</a></li>  
         <li><asp:LoginStatus ID="LoginStatus1" runat="server"   
                LogoutAction="RedirectToLoginPage" LogoutPageUrl="~/Login.aspx" /></li>  
        <li><a href="Help_FAQ.aspx">Help FAQ</a></li>  
        <li><a href="Newjob.aspx">New Job</a></li>  
        <li><a href="ChangePassword.aspx">Change Password</a></li>  
        <li><a href="#">Reports</a></li>  
      </ul> 
    </div> 
      
    <div id="b_2columns">  
<b>Current Live Jobs:</b><br /> 
 
        <telerik:RadScheduler ID="RadScheduler1" runat="server"   
            DataDescriptionField="jobDescription" DataEndField="jobEnd"   
            ValidateRequest="false" ValidationGroup="none" 
            DataKeyField="jobId" DataSourceID="SqlDataSource1" DataStartField="jobLive"   
            DataSubjectField="jobName" Skin="Windows7" Height="100%"   
            SelectedView="MonthView" Width="780px" CustomAttributeNames="fileUpload"   
            DataMember="DefaultView">  
            <AdvancedForm EnableCustomAttributeEditing="True" /> 
              
       <AdvancedInsertTemplate>   
         <href='<%# Eval("fileUpload") %>'>uploaded file</a> 
       </AdvancedInsertTemplate>   
 
            
</telerik:RadScheduler> 
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
            ConnectionString="<%$ ConnectionStrings:JT2010ConnectionString %>"   
              
            SelectCommand="SELECT [id], [jobId], [jobName], [jobType], [jobLive], [jobEnd], [jobStatus], [UserId], [fileUpload], [jobDescription] FROM [Jobs]">  
        </asp:SqlDataSource> 
    </div> 
    </div> 
    <div class="b_content_bottom"></div> 
 
<div id="b_footer"<href="Default.aspx">Home </a> | <href="">Support Wiki</a> | <href="">   
    Contact Us</a><br /> 
 
    all rights reserved 2009 - 2010</div> 
</div> 
</div> 
    </form> 
 
</body> 
</html> 

Imports Telerik.Web.UI  
 
Partial Class users_Default  
    Inherits System.Web.UI.Page  
    Protected Sub RadScheduler1_FormCreated(ByVal sender As ObjectByVal e As SchedulerFormCreatedEventArgs)  
        If e.Container.Mode = SchedulerFormMode.AdvancedEdit OrElse e.Container.Mode = SchedulerFormMode.AdvancedInsert Then 
            Dim submitArea As Panel = TryCast(e.Container.FindControl("ButtonsPanel").Parent, Panel)  
            Dim link1 As New HyperLink()  
            link1.Text = "upload file" 
            link1.NavigateUrl = e.Appointment.Attributes("fileUpload")  
            submitArea.Controls.Add(link1)  
        End If 
    End Sub 
End Class 

0
Dimitar Milushev
Telerik team
answered on 10 Mar 2010, 05:58 PM
Hi,

As Peter explained, you should modify your code as follows:

Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated 
    If e.Container.Mode = SchedulerFormMode.AdvancedEdit OrElse e.Container.Mode = SchedulerFormMode.AdvancedInsert Then
        Dim submitArea As Panel = TryCast(e.Container.FindControl("ButtonsPanel").Parent, Panel) 
        Dim link1 As New HyperLink() 
        link1.Text = "upload file"
        link1.NavigateUrl = e.Appointment.Attributes("fileUpload"
        submitArea.Controls.Add(link1) 
    End If
End Sub


Greetings,
Dimitar Milushev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler
Asked by
mike john
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Peter
Telerik team
mike john
Top achievements
Rank 1
Dimitar Milushev
Telerik team
Share this question
or