Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
118 views

Hi There,

I am working on the timeline view of the Scheduler. I set the back color for appointments in RadScheduler1_AppointmentDataBound function. But the back color of the appointments loses after clicking the cancel button on the advanced pop-up form. Please see the following for my test code. Any help is much appreciated.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadSchedulerTest.aspx.cs" Inherits="RadSchedulerTest" %>
<%@ 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">
 
<head runat="server">
    <title></title>
    <style type="text/css">
        .rsAptDelete {
            display: none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <div>
        <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="920"
            OnAppointmentInsert="RadScheduler1_AppointmentInsert" Reminders-Enabled="false"
            OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"
            DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
            DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId"
            DataReminderField="Reminder" SelectedView="TimelineView" ShowViewTabs="false" AppointmentStyleMode="Default"
            OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" OnNavigationComplete="RadScheduler1_NavigationComplete" ColumnWidth="28"
            OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" StartInsertingInAdvancedForm="true">
            <TimelineView ShowInsertArea="false" SlotDuration="1" GroupBy="User, Month" GroupingDirection="Vertical" ColumnHeaderDateFormat="MMM dd ddd" HeaderDateFormat="MMMM, yyyy"/> 
        </telerik:RadScheduler>
    </div>
    </form>
</body>
</html>

 

using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using Telerik.Web.UI.Calendar;
using Telerik.Web.UI.Calendar.View;
 
public partial class RadSchedulerTest : System.Web.UI.Page
{
    private const string AppointmentsKey = "Telerik.Web.Examples.Scheduler.BindToList.CS.Apts";
 
    private List<AppointmentInfo> Appointments
    {
        get
        {
            List<AppointmentInfo> sessApts = Session[AppointmentsKey] as List<AppointmentInfo>;
            if (sessApts == null)
            {
                sessApts = new List<AppointmentInfo>();
                Session[AppointmentsKey] = sessApts;
            }
 
            return sessApts;
        }
    }
 
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
 
        if (!IsPostBack)
        {
            Session.Remove(AppointmentsKey);
 
            InitializeResources();
            InitializeAppointments();
        }
 
        RadScheduler1.DataSource = Appointments;
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        RadScheduler1.EnableAjaxSkinRendering = true;
        if (!IsPostBack & RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
        {
            int year = RadScheduler1.SelectedDate.Year;
            int month = RadScheduler1.SelectedDate.Month;
            int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
            RadScheduler1.SelectedDate = new DateTime(year, month, 1);
            RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
        }
    }
 
    protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
    {
        if (RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
        {
            int year = RadScheduler1.SelectedDate.Year;
            int month = RadScheduler1.SelectedDate.Month;
            int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
            RadScheduler1.SelectedDate = new DateTime(year, month, 1);
            RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
        }
    }
 
    protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
    {
    }
 
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
    {
        e.Appointment.BackColor = System.Drawing.Color.FromName("#3d2f2b");
        e.Appointment.ForeColor = System.Drawing.Color.White;
    }
 
    protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
    {
        Appointments.Add(new AppointmentInfo(e.Appointment));
    }
 
    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
    {
        AppointmentInfo ai = FindById(e.ModifiedAppointment.ID);
        RecurrenceRule rrule;
 
        if (RecurrenceRule.TryParse(e.ModifiedAppointment.RecurrenceRule, out rrule))
        {
            rrule.Range.Start = e.ModifiedAppointment.Start;
            rrule.Range.EventDuration = e.ModifiedAppointment.End - e.ModifiedAppointment.Start;
            TimeSpan startTimeChange = e.ModifiedAppointment.Start - e.Appointment.Start;
            for (int i = 0; i < rrule.Exceptions.Count; i++)
            {
                rrule.Exceptions[i] = rrule.Exceptions[i].Add(startTimeChange);
            }
            e.ModifiedAppointment.RecurrenceRule = rrule.ToString();
        }
 
        ai.CopyInfo(e.ModifiedAppointment);
    }
 
    private void InitializeResources()
    {
        ResourceType resType = new ResourceType("User");
        resType.ForeignKeyField = "UserID";
 
        RadScheduler1.ResourceTypes.Add(resType);
        RadScheduler1.Resources.Add(new Resource("User", 1, "Test1"));
        RadScheduler1.Resources.Add(new Resource("User", 2, "Test2"));
        RadScheduler1.Resources.Add(new Resource("User", 3, "Test3"));
        RadScheduler1.Resources.Add(new Resource("User", 4, "Test4"));
        RadScheduler1.Resources.Add(new Resource("User", 5, "Test5"));
        RadScheduler1.Resources.Add(new Resource("User", 6, "Test6"));
        RadScheduler1.Resources.Add(new Resource("User", 7, "Test7"));
        RadScheduler1.Resources.Add(new Resource("User", 8, "Test8"));
        RadScheduler1.Resources.Add(new Resource("User", 9, "Test9"));
        RadScheduler1.Resources.Add(new Resource("User", 10, "Test10"));
    }
 
    private void InitializeAppointments()
    {
        DateTime start = DateTime.UtcNow.Date;
        start = start.AddDays(6);
        Appointments.Add(new AppointmentInfo("6", start, start.AddDays(1), string.Empty, null, string.Empty, 1));
        Appointments.Add(new AppointmentInfo("5", start.AddDays(2), start.AddDays(3), string.Empty, null, string.Empty, 2));
 
        start = start.AddDays(-1);
        DateTime dayStart = RadScheduler1.UtcDayStart(start);
        Appointments.Add(new AppointmentInfo("3", dayStart, dayStart.AddDays(1), string.Empty, null, string.Empty, 1));
        Appointments.Add(new AppointmentInfo("2", start.AddDays(2), start.AddDays(3), string.Empty, null, string.Empty, 2));
 
        start = start.AddDays(2);
        Appointments.Add(new AppointmentInfo("8", start.AddDays(2), start.AddDays(4), string.Empty, null, string.Empty, 1));
    }
 
    private AppointmentInfo FindById(object ID)
    {
        foreach (AppointmentInfo ai in Appointments)
        {
            if (ai.ID.Equals(ID))
            {
                return ai;
            }
        }
 
        return null;
    }
}
 
class AppointmentInfo
{
    private readonly string _id;
    private string _subject;
    private DateTime _start;
    private DateTime _end;
    private string _recurrenceRule;
    private string _recurrenceParentId;
    private string _reminder;
    private int? _userID;
 
    public string ID
    {
        get
        {
            return _id;
        }
    }
 
    public string Subject
    {
        get
        {
            return _subject;
        }
        set
        {
            _subject = value;
        }
    }
 
    public DateTime Start
    {
        get
        {
            return _start;
        }
        set
        {
            _start = value;
        }
    }
 
    public DateTime End
    {
        get
        {
            return _end;
        }
        set
        {
            _end = value;
        }
    }
 
    public string RecurrenceRule
    {
        get
        {
            return _recurrenceRule;
        }
        set
        {
            _recurrenceRule = value;
        }
    }
 
    public string RecurrenceParentID
    {
        get
        {
            return _recurrenceParentId;
        }
        set
        {
            _recurrenceParentId = value;
        }
    }
 
    public int? UserID
    {
        get
        {
            return _userID;
        }
        set
        {
            _userID = value;
        }
    }
 
    public string Reminder
    {
        get
        {
            return _reminder;
        }
        set
        {
            _reminder = value;
        }
    }
 
    private AppointmentInfo()
    {
        _id = Guid.NewGuid().ToString();
    }
 
    public AppointmentInfo(string subject, DateTime start, DateTime end,
        string recurrenceRule, string recurrenceParentID, string reminder, int? userID)
        : this()
    {
        _subject = subject;
        _start = start;
        _end = end;
        _recurrenceRule = recurrenceRule;
        _recurrenceParentId = recurrenceParentID;
        _reminder = reminder;
        _userID = userID;
    }
 
    public AppointmentInfo(Appointment source)
        : this()
    {
        CopyInfo(source);
    }
 
    public void CopyInfo(Appointment source)
    {
        Subject = source.Subject;
        Start = source.Start;
        End = source.End;
        RecurrenceRule = source.RecurrenceRule;
        if (source.RecurrenceParentID != null)
        {
            RecurrenceParentID = source.RecurrenceParentID.ToString();
        }
 
        if (!String.IsNullOrEmpty(Reminder))
        {
            Reminder = source.Reminders[0].ToString();
        }
 
        Resource user = source.Resources.GetResourceByType("User");
        if (user != null)
        {
            UserID = (int?)user.Key;
        }
        else
        {
            UserID = null;
        }
    }
}
Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 15 Nov 2016
1 answer
78 views

We have seen validation errors (we used W3C validator at https://validator.w3.org/) that are related to colspan being set to number that is less than the number of col elements defined in colgroup. Example:

<colgroup>
<col />
<col />
<col />
<col />
<col style="display:none;" />
</colgroup>
<thead>
<tr class="rgPager">
<td colspan="4">

We have seen these errors in your RadGrid demo source too (http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx)

When can we expect this issue to be resolved?

Thank you.

Milena
Telerik team
 answered on 15 Nov 2016
4 answers
534 views
Hi,

In my project, I always have exception with the WebResource.axd. For example:

Exception was thrown at line 4596, column 6 in http://localhost:49573/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:fr-FR:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI:fr-FR:df833b2e-28ee-45e7-8320-6f2a9cb883d7:16e4e7cd:f7645509:22a6274a:ed16cbdc:874f8ea2:24ee1bba:f46195d3:19620875:490a9d4e:bd8f85e4

And error in script is line:

{var f=this

 

._iframe.contentWindow.document.title;

So, as my project is huge, I reproduce it in a simple application:
I had a webpage with a RadWindow. Exception occur (javascript exception).
I had another webpage using a masterpage. This time, RadWindows even do not open!

I think it's a configuration pb but I'm unable to find it.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkingPage.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head id="Head1" runat="server">
    <title>Title</title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <script type="text/javascript">
            //Put your JavaScript code here.
        </script>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
 
        <!--RadWindow-->
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
                <telerik:RadWindow ID="RadWindow1" runat="server" Animation="Fade" Modal="True" NavigateUrl="http://www.c2i.fr" OpenerElementID="Button1" Style="display: none;" Title="C2I.FR" />
            </Windows>
        </telerik:RadWindowManager>
        <asp:Button ID="Button1" runat="server" Text="Button" />
         
 
    </form>
</body>
</html>

And here is my web.config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="Telerik.Skin" value="Office2010Silver"/>
    <add key="Telerik.ScriptManager.TelerikCdn" value="Disabled"/>
    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Disabled"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <pages>
      <controls>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
      </controls>
    </pages>
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="RadCompression"/>
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode"/>
    </modules>
    <handlers>
      <remove name="Telerik_Web_UI_WebResource_axd"/>
      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/>
    </handlers>
  </system.webServer>
</configuration>


Thank's to take your time to help me.

 

 


Quest
Top achievements
Rank 1
 answered on 15 Nov 2016
3 answers
93 views

Hi

I am using the RadRating list control.  Once the user has entered there data - I would like to show what they have chosen on the next page.  The value they have chosen is storing just fine.  But when they are on the next page I want to show the rating they choose.  I thought the RadRating1.SelectedItem.Value might do the trick but this does not set the item that has been selected.

Any ideas how I show the item they selected on another page - but using the same RadRating control

Thanks in advance

 


Indy
Top achievements
Rank 1
 answered on 15 Nov 2016
5 answers
319 views
Hi,

I have telerik Rad Grid Control. I want disabled row to be checked even if someone check/uncheck select all functionality. So I have written below Jquery code to handle it.

$(document).ready(function () {
        $("#SelectColumnSelectCheckBox").click(function () {
            var checked = this.checked;                      
            if (checked == false) {
                $("#ctl00_MainContent_gridRules_ctl00 tbody tr").each(function () {
                    if ($(this).attr('disabled') == "disabled") {
                        $(this).find("input").attr('checked', 'checked');
                    }
                });
            }
        });
    });

I want to change the hardcoded value of grid (ctl00_MainContent_gridRules_ctl00) and Select all checkbox (SelectColumnSelectCheckBox) to clientID.

I have tried <%=Radgrid.ClientID%> but that does not work.

Does anyone know how to get the clientID of the telerik RAD grid?

Please give me reply sooner as this is urgent for me.

Thanks in advance.

Regards,
Devendra.
Marin Bratanov
Telerik team
 answered on 15 Nov 2016
4 answers
120 views

Hi,

I have a "Rneame" context menu on my treeview that gets handled client-side and initiates node.startEdit(); The node goes into edit mode & the user can edit the text and hit enter and all looks fine on-screen.

The problem come during postback though - the node in code-behind still has the old name?

 

function tvwListData_ClientContextMenuItemClick(sender, args) {
 
    var tree = $find("<%= tvwListData.ClientID %>");           
    var node = args.get_node();           
 
    tree.trackChanges();
 
    var item = args.get_menuItem();
    switch (item.get_value()) {
 
        case "Rename":
            node.startEdit();
            break;
 
        case "Delete":
            node.get_parent().get_nodes().remove(node);
            break;
    }           
    tree.commitChanges();
}
Ivan Danchev
Telerik team
 answered on 15 Nov 2016
2 answers
251 views

Hi,

I have a RadGrid inside the EditForm of the main RadGrid:

<telerik:RadGrid runat="server" ID="RadGrid1">
  <EditFormSettings EditFormType="Template">
    <FormTemplate>
      <div>
        <asp:Panel runat="server" ID="Panel1">
          <table><tr><td>
            <telerik:RadGrid runat="server" ID="InnerRadGrid"></telerik:RadGrid>
          </td></tr></table>
        </asp:Panel>
      </div>
    </FormTemplate>
  </EditFormSettings>
</telerik:RadGrid>

 

How can I reach via javascript the InnerRadGrid

I tried using 

RadGrid1.Controls.Add(new LiteralControl("<script type='text/javascript'>window['InnerRadGrid'] = '" + InnerRadGrid.ClientID + "';</script>"));
 var grid = document.getElementById(window['InnerRadGrid']);

 

in RadGrid1_ItemCreated() but id doesn't work.

 

I need it because in the header of some TemplateColumn in the InnerRadGrid I have a checkbox which, when toggled, shoul select/deselect every checkbox in that column. If there is another way to reach this functionality, it'd be fine.

 

Thank you, regards

Nick

Nick
Top achievements
Rank 1
 answered on 15 Nov 2016
3 answers
176 views

On the Telerik site, hyperlinks are not encoded when saving the link in Linkmanager, see screenshot #1.

 

In our application the %20 are once more encoded to %2520 when OK-ing the Linkmanager, see screenshot #2.

 

All ContentFiltering is set Standard, just like the demo site...I am using EditorDialogs/LinkManager.ascx though.

 

Marc

 

Vessy
Telerik team
 answered on 15 Nov 2016
1 answer
279 views

Hi All,
I’m facing a performance problem with a new website that we have developed. After checking the website with Gtmetrix I got bad results for the bellow

Leverage browser caching
Specify a cache validator
Defer parsing of JavaScript

I’m also attaching a Print Screen. I did a research over the web but I didn’t find a solution for my problem.

Do you have any Suggestion?

Marin Bratanov
Telerik team
 answered on 15 Nov 2016
3 answers
145 views
How can I force new item to be saved before user clicks "add new" again. Sometimes user press "add new" by accident and the data will be lost.
Eyup
Telerik team
 answered on 15 Nov 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?